3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public static method foo() { return 1; } } function fa () { return 1; } function fb () { return 1; } function fc () { return 1; } $calla = 'fa'; $callb = 'fb'; $callc = 'fc'; $class = 'Test'; $method = 'foo();' $calld = $class.'::'.$method.'()'; $time = microtime( true ); for( $i = 5000; $i--; ) { $x = 0; $x += $calla(); $x += $callb(); $x += $callc(); $x += $calld(); if( $x != 4 ) die( 'Bad numbers' ); } echo( "Variable functions took " . (microtime( true ) - $time) . " seconds.<br />" ); $time = microtime( true ); for( $i = 5000; $i--; ) { $x = 0; $x += call_user_func($calla); $x += call_user_func($callb); $x += call_user_func($callc); $x += call_user_func($calld); if( $x != 4 ) die( 'Bad numbers' ); } echo( "call_user_func took " . (microtime( true ) - $time) . " seconds.<br />" ); $time = microtime( true ); for( $i = 5000; $i--; ) { $x = 0; $x += call_user_func([$class, $method]); if( $x != 1 ) die( 'Bad numbers' ); } echo( "call_user_func 2 took " . (microtime( true ) - $time) . " seconds.<br />" ); ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.0.20.0270.05020.26
7.0.10.0070.08320.16
7.0.00.0070.08320.10
5.6.160.0100.05320.44
5.6.150.0000.08718.25
5.6.140.0170.05018.27
5.6.130.0070.08018.27
5.6.120.0070.07321.12
5.6.110.0030.08021.01
5.6.100.0100.08020.97
5.6.90.0170.07320.87
5.6.80.0000.04720.34
5.5.300.0030.03717.96
5.5.290.0130.04317.92
5.5.280.0070.03720.80
5.5.270.0130.08720.88
5.5.260.0100.08320.75
5.5.250.0000.04720.58
5.5.240.0300.07020.25

preferences:
139.06 ms | 1394 KiB | 7 Q