3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Tester { public function doNothing() { $res = array(); for ( $i = 0; $i < 10000; $i++) { $res[$i] = new StdClass; } } } $t = new Tester(); echo "Before: ".memory_get_usage()."\n"; $t->doNothing(); echo "After: ".memory_get_usage()."\n";
Output for 7.1.0
Before: 348160 After: 471072
Output for 7.0.0 - 7.0.14
Before: 348176 After: 471088
Output for 5.6.0 - 5.6.28
Before: 221040 After: 1204160
Output for 5.5.0 - 5.5.38
Before: 221032 After: 1204136
Output for 5.4.0 - 5.4.45
Before: 221544 After: 1204648
Output for 5.3.11 - 5.3.29
Before: 624456 After: 1607696
Output for 5.3.0 - 5.3.10
Before: 624152 After: 1607392
Output for 5.2.10 - 5.2.17
Before: 82192 After: 819840
Output for 5.2.7 - 5.2.9
Before: 82960 After: 951000
Output for 5.2.3 - 5.2.6
Before: 83280 After: 951320
Output for 5.2.2
Before: 81208 After: 949200
Output for 5.2.1
Before: 81208 After: 850880
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function memory_get_usage() in /in/ANaau on line 12
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/ANaau on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/ANaau on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/ANaau on line 3
Process exited with code 255.