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 ); }
Output for 8.2.7
function call is 124.73% faster
Output for 8.2.6
function call is 119.71% faster
Output for 8.2.5
function call is 105.87% faster
Output for 8.2.4
function call is 120.77% faster
Output for 8.2.3
function call is 145.84% faster
Output for 8.2.2
function call is 141.36% faster
Output for 8.2.1
function call is 125.85% faster
Output for 8.2.0
function call is 124.63% faster
Output for 8.1.20
function call is 125.37% faster
Output for 8.1.19
function call is 118.26% faster
Output for 8.1.18
function call is 126.40% faster
Output for 8.1.17
function call is 114.17% faster
Output for 8.1.16
function call is 112.29% faster
Output for 8.1.15
function call is 130.47% faster
Output for 8.1.14
function call is 100.34% faster
Output for 8.1.13
function call is 143.11% faster
Output for 8.1.12
function call is 128.86% faster
Output for 8.1.11
function call is 126.13% faster
Output for 8.1.10
function call is 134.38% faster
Output for 8.1.9
function call is 131.37% faster
Output for 8.1.8
function call is 142.16% faster
Output for 8.1.7
function call is 114.20% faster
Output for 8.1.6
function call is 108.45% faster
Output for 8.1.5
function call is 130.31% faster
Output for 8.1.4
function call is 131.51% faster
Output for 8.1.3
function call is 157.47% faster
Output for 8.1.2
function call is 118.70% faster
Output for 8.1.1
function call is 120.32% faster
Output for 8.1.0
function call is 146.89% faster
Output for 8.0.29
function call is 144.09% faster
Output for 8.0.28
function call is 107.11% faster
Output for 8.0.27
function call is 126.14% faster
Output for 8.0.26
function call is 130.97% faster
Output for 8.0.25
function call is 125.95% faster
Output for 8.0.24
static method is 90.93% faster
Output for 8.0.23
function call is 134.88% faster
Output for 8.0.22
function call is 128.31% faster
Output for 8.0.21
function call is 123.99% faster
Output for 8.0.20
function call is 142.11% faster
Output for 8.0.19
function call is 118.45% faster
Output for 8.0.18
function call is 153.15% faster
Output for 8.0.17
function call is 138.14% faster
Output for 8.0.16
function call is 114.06% faster
Output for 8.0.15
function call is 116.78% faster
Output for 8.0.14
function call is 125.39% faster
Output for 8.0.13
function call is 118.89% faster
Output for 8.0.12
function call is 116.74% faster
Output for 8.0.11
function call is 115.42% faster
Output for 8.0.10
function call is 115.59% faster
Output for 8.0.9
function call is 114.18% faster
Output for 8.0.8
function call is 113.13% faster
Output for 8.0.7
function call is 115.86% faster
Output for 8.0.6
function call is 112.04% faster
Output for 8.0.5
function call is 121.66% faster
Output for 8.0.3
function call is 114.00% faster
Output for 8.0.2
function call is 113.40% faster
Output for 8.0.1
function call is 116.88% faster

preferences:
78.72 ms | 485 KiB | 6 Q