3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $num_tests = 10; $startFirst = $startSecond = $endFirst = $endSecond = $startFirstMemory = $endFirstMemory = $startSecondMemory = $endSecondMemory = $someVal = 0; $times = array( '$i++' => array( 'time' => 0, 'memory' => 0 ), '++$i' => array( 'total' => 0, 'memory' => 0 ) ); for( $j = 0; $j < $num_tests; ++$j ) { for( $i = 0, $startFirstMemory = memory_get_usage( ), $startFirst = microtime( true ); $i < 10000000; $i++ ){ $someval = 2; } $endFirstMemory = memory_get_usage( ); $endFirst = microtime( true ); for( $i = 0, $startSecondMemory = memory_get_usage( ), $startSecond = microtime( true ); $i < 10000000; ++$i ){ $someval = 2; } $endSecondMemory = memory_get_usage( ); $endSecond = microtime( true ); $times[ '$i++' ][ $j ] = array( 'startTime' => $startFirst, 'endTime' => $endFirst, 'startMemory' => $startFirstMemory, 'endMemory' => $endFirstMemory ); $times[ '++$i' ][ $j ] = array( 'startTime' => $startSecond, 'endTime' => $endSecond, 'startMemory' => $startSecondMemory, 'endMemory' => $endSecondMemory ); } for( $i = 0; $i < $num_tests; ++$i ) { $times[ '$i++' ][ 'time' ] += ( $times[ '$i++' ][ $i ][ 'endTime' ] - $times[ '$i++' ][ $i ][ 'startTime' ] ); $times[ '++$i' ][ 'time' ] += ( $times[ '++$i' ][ $i ][ 'endTime' ] - $times[ '++$i' ][ $i ][ 'startTime' ] ); $times[ '$i++' ][ 'memory' ] += ( $times[ '$i++' ][ $i ][ 'endMemory' ] - $times[ '$i++' ][ $i ][ 'startMemory' ] ); $times[ '++$i' ][ 'memory' ] += ( $times[ '++$i' ][ $i ][ 'endMemory' ] - $times[ '++$i' ][ $i ][ 'startMemory' ] ); } echo 'There were ' . $num_tests . ' tests conducted, here\'s the totals<br /><br /> $i++ took ' . $times[ '$i++' ][ 'time' ] . ' seconds and ' . $times[ '$i++' ][ 'memory' ] . ' bytes<br /> ++$i took ' . $times[ '++$i' ][ 'time' ] . ' seconds and ' . $times[ '++$i' ][ 'memory' ] . ' bytes';

Abusive script

This script was stopped while abusing our resources

Output for 7.1.7
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.0657019615173 seconds and 0 bytes<br /> ++$i took 0.81276750564575 seconds and 0 bytes
Output for 7.1.6
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.0803611278534 seconds and 0 bytes<br /> ++$i took 0.83226490020752 seconds and 0 bytes
Output for 7.1.5
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.0154223442078 seconds and 0 bytes<br /> ++$i took 0.80877447128296 seconds and 0 bytes
Output for 7.1.4
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 0.96099162101746 seconds and 0 bytes<br /> ++$i took 0.72207045555115 seconds and 0 bytes
Output for 7.1.3
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 0.99419498443604 seconds and 0 bytes<br /> ++$i took 0.75767207145691 seconds and 0 bytes
Output for 7.1.2
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.0416650772095 seconds and 0 bytes<br /> ++$i took 0.78823637962341 seconds and 0 bytes
Output for 7.1.1
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.058089017868 seconds and 0 bytes<br /> ++$i took 0.7887864112854 seconds and 0 bytes
Output for 7.1.0
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.0391049385071 seconds and 0 bytes<br /> ++$i took 0.81813836097717 seconds and 0 bytes
Output for 7.0.20
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.2131857872009 seconds and 0 bytes<br /> ++$i took 0.84241890907288 seconds and 0 bytes
Output for 7.0.19
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.035845041275 seconds and 0 bytes<br /> ++$i took 0.73577952384949 seconds and 0 bytes
Output for 7.0.18
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.0848338603973 seconds and 0 bytes<br /> ++$i took 0.80748414993286 seconds and 0 bytes
Output for 7.0.17
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.1202778816223 seconds and 0 bytes<br /> ++$i took 0.88572478294373 seconds and 0 bytes
Output for 7.0.16
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.2436318397522 seconds and 0 bytes<br /> ++$i took 0.96265196800232 seconds and 0 bytes
Output for 7.0.15
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.2153038978577 seconds and 0 bytes<br /> ++$i took 0.93321466445923 seconds and 0 bytes
Output for 7.0.14
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.1288006305695 seconds and 0 bytes<br /> ++$i took 0.79111552238464 seconds and 0 bytes
Output for 7.0.13
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.0382537841797 seconds and 0 bytes<br /> ++$i took 0.77801156044006 seconds and 0 bytes
Output for 7.0.12
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.1450970172882 seconds and 0 bytes<br /> ++$i took 0.91887736320496 seconds and 0 bytes
Output for 5.3.0 - 5.6.30, hhvm-3.10.1 - 3.17.3, 7.0.5 - 7.0.8, 7.0.10 - 7.0.11

Process exited with code 137.
Output for 7.0.9
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.0704519748688 seconds and 0 bytes<br /> ++$i took 0.82539916038513 seconds and 0 bytes
Output for 7.0.4
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.0047326087952 seconds and 0 bytes<br /> ++$i took 0.76065063476562 seconds and 0 bytes
Output for 7.0.3
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.1770193576813 seconds and 0 bytes<br /> ++$i took 0.89038038253784 seconds and 0 bytes
Output for 7.0.2
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.2131085395813 seconds and 0 bytes<br /> ++$i took 0.89526987075806 seconds and 0 bytes
Output for 7.0.1
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.1348669528961 seconds and 0 bytes<br /> ++$i took 0.85605812072754 seconds and 0 bytes
Output for 7.0.0
Notice: Undefined index: time in /in/UDD1l on line 23 There were 10 tests conducted, here's the totals<br /><br /> $i++ took 1.0749723911285 seconds and 0 bytes<br /> ++$i took 0.83148264884949 seconds and 0 bytes