3v4l.org

run code in 300+ PHP versions simultaneously
<?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.4.0
Before: 388576 After: 511488
Output for 7.3.0 - 7.3.12
Before: 388520 After: 511432
Output for 7.2.17 - 7.2.25
Before: 384728 After: 507640
Output for 7.2.0
Before: 384768 After: 507680
Output for 7.1.26 - 7.1.33
Before: 348088 After: 471000
Output for 7.1.0, 7.1.7
Before: 348160 After: 471072
Output for 7.1.5 - 7.1.6
Before: 348376 After: 471288
Output for 7.0.0 - 7.0.20
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.0.5, 5.1.0 - 5.1.6, 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.3.11, 4.4.0 - 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.

preferences:
167.23 ms | 401 KiB | 247 Q