Created
May 23, 2019 14:24
-
-
Save rrazor/b87b2c1c8833dc2609a560ebdd5a137a to your computer and use it in GitHub Desktop.
Test showing that time() can be earlier than \DateTime() despite later in execution order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
for ($tries = 0; $tries < 500000; ++$tries) { | |
$first = (int)((new \DateTime('now'))->format('U')); | |
$second = \time(); | |
if ($second < $first) { | |
die("The second time was earlier after $tries tries:\n" | |
. " First: $first\n" | |
. " Second: $second\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment