3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = []; for($i = 0; 9999 > $i; $i++){ $array[] = $i; } $startTimeForLoop = time(); foreach($array as $key => $value){ $foo = 'bar'; } echo 'time needed for loop: ' . time()-$startTimeForLoop; echo '<br>'; $startTimeForEnd = time(); var_dump(end($array)); echo 'time needed for end()' . time()-$startTimeForEnd;
Output for 7.4.0
Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /in/dVAre on line 12 Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /in/dVAre on line 17 Warning: A non-numeric value encountered in /in/dVAre on line 12 -1527660100<br>int(9998) Warning: A non-numeric value encountered in /in/dVAre on line 17 -1527660100
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.25, 7.3.0 - 7.3.12
Warning: A non-numeric value encountered in /in/dVAre on line 12 -1527660100<br>int(9998) Warning: A non-numeric value encountered in /in/dVAre on line 17 -1527660100

preferences:
79.21 ms | 402 KiB | 62 Q