3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class EmptySetter { public function __set($name, $value) {} } class NonEmptySetter { public function __set($name, $value) { $this->{$name} = $value; } } function benchmark($obj) { $start_time = microtime(TRUE); for ($i = 0; $i < 10000000; $i++) { $obj->foo = 42; } return microtime(TRUE) - $start_time; } printf("EmptySetter: %.2f seconds\n", benchmark(new EmptySetter)); printf("NonEmptySetter: %.2f seconds\n", benchmark(new NonEmptySetter));
Output for 7.1.0
EmptySetter: 1.24 seconds NonEmptySetter: 0.01 seconds
Output for 7.0.14
EmptySetter: 1.49 seconds NonEmptySetter: 0.21 seconds
Output for 7.0.2, 7.0.4, 7.0.6
EmptySetter: 0.88 seconds NonEmptySetter: 0.17 seconds
Output for 7.0.5
EmptySetter: 0.90 seconds NonEmptySetter: 0.17 seconds
Output for 7.0.3
EmptySetter: 0.93 seconds NonEmptySetter: 0.17 seconds
Output for 7.0.0 - 7.0.1
EmptySetter: 0.94 seconds NonEmptySetter: 0.17 seconds
Output for 5.0.0 - 5.4.45, 5.5.27, 5.5.31, 5.5.33, 5.6.13, hhvm-3.12.0

Process exited with code 137.
Output for hhvm-3.10.0
EmptySetter: 1.64 seconds
Process exited with code 137.
Output for 5.6.28
EmptySetter: 2.22 seconds
Process exited with code 137.
Output for 5.6.21
EmptySetter: 2.26 seconds
Process exited with code 137.
Output for 5.6.20
EmptySetter: 2.00 seconds
Process exited with code 137.
Output for 5.5.28, 5.6.9, 5.6.18 - 5.6.19
EmptySetter: 1.95 seconds
Process exited with code 137.
Output for 5.6.17
EmptySetter: 1.98 seconds
Process exited with code 137.
Output for 5.6.16
EmptySetter: 2.02 seconds
Process exited with code 137.
Output for 5.5.34, 5.6.8, 5.6.15
EmptySetter: 1.96 seconds
Process exited with code 137.
Output for 5.5.25, 5.6.14
EmptySetter: 1.99 seconds
Process exited with code 137.
Output for 5.5.26, 5.5.29, 5.6.10, 5.6.12
EmptySetter: 1.94 seconds
Process exited with code 137.
Output for 5.6.11
EmptySetter: 1.93 seconds
Process exited with code 137.
Output for 5.5.35
EmptySetter: 1.82 seconds NonEmptySetter: 0.47 seconds
Output for 5.5.32
EmptySetter: 1.88 seconds
Process exited with code 137.
Output for 5.5.30
EmptySetter: 1.89 seconds NonEmptySetter: 0.53 seconds
Output for 5.5.24
EmptySetter: 1.76 seconds NonEmptySetter: 0.45 seconds
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/V4GYr 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/V4GYr 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/V4GYr on line 3
Process exited with code 255.