3v4l.org

run code in 300+ PHP versions simultaneously
<?php class EmptySetter { public $foo = NULL; 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));

preferences:
51.3 ms | 402 KiB | 5 Q