3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { private $a = 5; private $b = 10; private $c = 15; private $d = 20; } $instances = []; $s = microtime(true); for ($i = 0; $i < 1000000; $i++) { $instances[] = new A(); } var_dump(microtime(true) - $s); $instances = []; $instance = new A(); $s = microtime(true); for ($i = 0; $i < 1000000; $i++) { $instances[] = clone $instance; } var_dump(microtime(true) - $s);
Output for 7.0.0 - 7.1.0
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 4096 bytes) in /in/Z7P4M on line 14
Process exited with code 255.
Output for hhvm-3.12.0
float(0.33338594436646) float(0.12335705757141)
Output for hhvm-3.10.0
float(0.21891593933105) float(0.1236310005188)
Output for 5.5.24 - 5.6.28
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/Z7P4M on line 14
Process exited with code 255.
Output for 5.4.0 - 5.4.45
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 72 bytes) in /in/Z7P4M on line 14
Process exited with code 255.
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/Z7P4M on line 11
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/Z7P4M on line 11
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/Z7P4M on line 5
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/Z7P4M on line 5
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/Z7P4M on line 5
Process exited with code 255.