3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { return 1234; } class Foo { public static function asdf() { return 1234; } } $iterations = 1000000; $process = foo(); $process = Foo::asdf(); // Old $a = microtime( true ); for ( $i = 0; $i < $iterations; $i++ ) { $process = foo(); } $b = microtime( true ); $delta1 = $b - $a; // New $x = microtime( true ); for ( $j = 0; $j < $iterations; $j++ ) { $process = Foo::asdf(); } $y = microtime( true ); $delta2 = $y - $x; $percentage = $delta2 / $delta1 * 100; if ( $delta2 < $delta1 ) { printf( 'static method is %.2f%% faster', $percentage ); } else { printf( 'function call is %.2f%% faster', $percentage ); }

preferences:
30.04 ms | 405 KiB | 5 Q