3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $member; } $object = new Test(); $array = [ "member" => 1 ]; function test_object($object, $limit) { for ($i = 0; $i < $limit; $i++) { $object->member; } } function test_array(&$array, $limit) { for ($i = 0; $i < $limit; $i++) { $array["member"]; } } $start = microtime(true); test_object($object, 1000000); printf("objects: %.6f\n", microtime(true) - $start); sleep(1); $start = microtime(true); test_array($array, 1000000); printf("arrays: %.6f\n", microtime(true) - $start); ?>

preferences:
24.23 ms | 406 KiB | 5 Q