3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SomeClass { static function doTest($var) {return $var;} } class SomeObj { function doTest($var) {return $var;} static function doTest2($var) {return $var;} } //bench static call $starttime = microtime(true); for ($i = 0; $i< 100000; $i++) SomeClass::doTest($i); echo "Static call time: " , (microtime(true)-$starttime) , " ms "; //bench object method $starttime = microtime(true); $obj = new SomeObj(); for ($i = 0; $i< 100000; $i++) $obj->doTest($i); echo "Object method call time: " , (microtime(true)-$starttime) , " ms "; //bench static call $starttime = microtime(true); for ($i = 0; $i< 100000; $i++) SomeObj::doTest2($i); echo "Static call (when the static is in the same class of object method) time: " , (microtime(true)-$starttime) , " ms ";

preferences:
35.66 ms | 402 KiB | 5 Q