3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NonEmptySetter { public function __set($name, $value) { $this->{$name} = $value; } } class EmptySetter { public function __set($name, $value) {} } function benchmark($obj) { $start_time = microtime(TRUE); for ($i = 0; $i < 1000000; $i++) { $obj->foo = 42; } return microtime(TRUE) - $start_time; } printf("NonEmptySetter: %.2f seconds\n", benchmark(new NonEmptySetter)); printf("EmptySetter: %.2f seconds\n", benchmark(new EmptySetter));

preferences:
30.77 ms | 402 KiB | 5 Q