3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'Using default precision:',PHP_EOL; $time = $_SERVER['REQUEST_TIME_FLOAT']; var_dump(ini_get('precision')); var_dump($time); $time_string = addslashes($time); var_dump($time_string); $recast_time = (float) $time_string; var_dump($recast_time); var_dump($time === $recast_time); echo PHP_EOL,'Using substantially higher precision:',PHP_EOL; ini_set('precision', 50); $time = $_SERVER['REQUEST_TIME_FLOAT']; var_dump(ini_get('precision')); var_dump($time); $time_string = addslashes($time); var_dump($time_string); $recast_time = (float) $time_string; var_dump($recast_time); var_dump($time === $recast_time);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
Using default precision: string(2) "14" float(1574679883.0001) string(15) "1574679883.0001" float(1574679883.0001) bool(true) Using substantially higher precision: string(2) "50" float(1574679883.0001) string(33) "1574679883.0000998973846435546875" float(1574679883.0001) bool(true)
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.8, 5.6.10 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Using default precision: string(2) "14" float(1574679883.0001) string(15) "1574679883.0001" float(1574679883.0001) bool(true) Using substantially higher precision: string(2) "50" float(1574679883.0000998973846435546875) string(33) "1574679883.0000998973846435546875" float(1574679883.0000998973846435546875) bool(true)
Output for 5.6.9
Using default precision: string(2) "14" float(1574679884.0001) string(15) "1574679884.0001" float(1574679884.0001) bool(true) Using substantially higher precision: string(2) "50" float(1574679884.0000998973846435546875) string(33) "1574679884.0000998973846435546875" float(1574679884.0000998973846435546875) bool(true)
Output for 5.3.0 - 5.3.29
Using default precision: Notice: Undefined index: REQUEST_TIME_FLOAT in /in/3dEnW on line 3 string(2) "14" NULL string(0) "" float(0) bool(false) Using substantially higher precision: Notice: Undefined index: REQUEST_TIME_FLOAT in /in/3dEnW on line 16 string(2) "50" NULL string(0) "" float(0) bool(false)
Output for 4.3.10 - 4.3.11, 4.4.0 - 4.4.9, 5.0.2 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Using default precision: Notice: Undefined index: REQUEST_TIME_FLOAT in /in/3dEnW on line 3 string(2) "14" NULL string(0) "" float(0) bool(false) Using substantially higher precision: Notice: Undefined index: REQUEST_TIME_FLOAT in /in/3dEnW on line 16 string(2) "50" NULL string(0) "" float(0) bool(false)
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Using default precision: Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/3dEnW on line 2 PHP_EOL Notice: Undefined index: REQUEST_TIME_FLOAT in /in/3dEnW on line 3 string(2) "14" NULL string(0) "" float(0) bool(false) Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/3dEnW on line 13 PHP_EOLUsing substantially higher precision: Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/3dEnW on line 13 PHP_EOL Notice: Undefined index: REQUEST_TIME_FLOAT in /in/3dEnW on line 16 string(2) "50" NULL string(0) "" float(0) bool(false)

preferences:
85.78 ms | 415 KiB | 5 Q