3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = microtime(true); // keep calling microtime for about 3 seconds while(microtime(true) - $start < 3) { } $data = getrusage(); echo "User time: ". ($data['ru_utime.tv_sec'] + $data['ru_utime.tv_usec'] / 1000000); echo "System time: ". ($data['ru_stime.tv_sec'] + $data['ru_stime.tv_usec'] / 1000000); /* prints User time: 1.088171 System time: 1.675315 */ Now we have quite a bit of echo "Initial: ".memory_get_usage()." bytes \n"; /* prints Initial: 361400 bytes */ // let's use up some memory for ($i = 0; $i < 100000; $i++) { $array[$i] = md5($i); } // let's remove half of the array for ($i = 0; $i < 100000; $i++) { unset($array[$i]); } echo "Final: ".memory_get_usage()." bytes \n"; /* prints Final: 885912 bytes */ echo "Peak: ".memory_get_peak_usage()." bytes \n"; /* prints Peak: 13687072 bytes */
Output for 5.4.0 - 5.4.15
Parse error: syntax error, unexpected 'we' (T_STRING) in /in/0AE98 on line 20
Process exited with code 255.
Output for 5.3.0 - 5.3.25
Parse error: syntax error, unexpected T_STRING in /in/0AE98 on line 20
Process exited with code 255.

preferences:
171.26 ms | 1395 KiB | 49 Q