3v4l.org

run code in 300+ PHP versions simultaneously
<?php function call_user_func_fixed() { // Not much point in writing all that logic out twice, just require that both fixer functions are present $args = func_get_args(); $callable = array_shift($args); return call_user_func_array_fixed($callable, $args); } function call_user_func_array_fixed($callable, $args) { var_dump(debug_backtrace()); $isStaticMethod = false; // Normalize the $callable and see if it looks like a static method if (is_object($callable) && $callable instanceof Closure) { $func = $callable; } else if (is_string($callable)) { $expr = '/^([a-z_\x7f-\xff][\w\x7f-\xff]*)::([a-z_\x7f-\xff][\w\x7f-\xff]*)$/i'; if (preg_match($expr, $callable, $matches)) { $func = array($matches[1], $matches[2]); $isStaticMethod = true; } else { $func = $callable; } } else if (is_array($callable) && isset($callable[0], $callable[1]) && count($callable) === 2) { if (is_object($callable[0])) { $func = $callable; } else if (is_string($callable[0])) { $func = $callable; $isStaticMethod = true; } } // If it's not a valid callable give up here if (!isset($callable) || (!$isStaticMethod && !is_callable($callable))) { trigger_error('call_user_func() expects parameter 1 to be a valid callback', E_USER_WARNING); return null; } // If it's not a static method use the regular mechanism if (!$isStaticMethod) { return call_user_func_array($func, $args); } // Get a reference to the static method if possible try { $class = new ReflectionClass($func[0]); $method = $class->getMethod($func[1]); } catch (ReflectionException $e) { trigger_error('call_user_func() expects parameter 1 to be a valid callback', E_USER_WARNING); return null; } // Invoke the method with the passed arguments and return the result return $method->invokeArgs(null, $args); } class Car { public function run() { return call_user_func_fixed('Toyota::getName'); // should call toyota } private static function getName() { return 'Car'; } } class Toyota extends Car { public static function getName() { return 'Toyota'; } } $car = new Car(); echo $car->run(); //Car instead of Toyota $toyota = new Toyota(); echo $toyota->run(); //Car instead of Toyota

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)
8.3.40.0120.00319.09
8.3.30.0060.00919.05
8.3.20.0090.00019.02
8.3.10.0040.00421.09
8.3.00.0040.00421.89
8.2.170.0120.00322.96
8.2.160.0110.00320.35
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0050.00319.89
8.2.110.0060.00322.27
8.2.100.0060.00618.09
8.2.90.0040.00418.03
8.2.80.0050.00519.11
8.2.70.0050.00317.93
8.2.60.0040.00417.93
8.2.50.0030.00618.10
8.2.40.0000.00818.28
8.2.30.0000.00721.30
8.2.20.0040.00417.91
8.2.10.0000.00817.99
8.2.00.0040.00417.79
8.1.270.0050.00323.99
8.1.260.0000.00926.35
8.1.250.0050.00528.09
8.1.240.0000.00923.83
8.1.230.0100.00322.75
8.1.220.0060.00317.79
8.1.210.0080.00018.77
8.1.200.0090.00017.47
8.1.190.0000.00817.35
8.1.180.0030.00518.10
8.1.170.0050.00518.62
8.1.160.0000.00718.93
8.1.150.0040.00418.81
8.1.140.0040.00417.59
8.1.130.0030.00317.88
8.1.120.0040.00417.53
8.1.110.0050.00317.64
8.1.100.0040.00417.51
8.1.90.0040.00417.69
8.1.80.0050.00317.52
8.1.70.0000.00817.57
8.1.60.0000.00817.68
8.1.50.0000.00817.61
8.1.40.0030.00517.73
8.1.30.0080.00017.84
8.1.20.0030.00617.88
8.1.10.0060.00317.78
8.1.00.0040.00417.70
8.0.300.0000.00720.29
8.0.290.0060.00316.88
8.0.280.0000.00718.57
8.0.270.0040.00417.32
8.0.260.0030.00516.95
8.0.250.0040.00417.11
8.0.240.0040.00417.13
8.0.230.0030.00617.07
8.0.220.0050.00317.05
8.0.210.0040.00417.09
8.0.200.0070.00017.02
8.0.190.0000.00817.11
8.0.180.0030.00517.13
8.0.170.0060.00317.09
8.0.160.0070.00017.08
8.0.150.0060.00317.04
8.0.140.0000.00817.03
8.0.130.0000.00613.42
8.0.120.0060.00316.91
8.0.110.0030.00616.96
8.0.100.0030.00516.93
8.0.90.0030.00516.94
8.0.80.0060.01017.00
8.0.70.0080.00017.01
8.0.60.0080.00017.03
8.0.50.0070.00016.93
8.0.30.0140.00617.30
8.0.20.0120.00917.40
8.0.10.0040.00417.13
8.0.00.0110.01016.95
7.4.330.0000.00514.99
7.4.320.0030.00316.61
7.4.300.0060.00016.63
7.4.290.0000.00816.75
7.4.280.0030.00316.78
7.4.270.0030.00316.84
7.4.260.0030.00313.50
7.4.250.0030.00516.86
7.4.240.0050.00316.85
7.4.230.0040.00416.84
7.4.220.0140.00416.84
7.4.210.0100.00716.80
7.4.200.0000.00816.63
7.4.190.0040.00416.80
7.4.160.0180.00016.60
7.4.150.0070.01417.40
7.4.140.0100.01417.86
7.4.130.0090.01416.75
7.4.120.0060.01616.78
7.4.110.0120.00716.69
7.4.100.0110.01516.66
7.4.90.0070.01316.57
7.4.80.0150.00419.37
7.4.70.0090.00916.91
7.4.60.0070.01016.81
7.4.50.0030.00616.73
7.4.40.0060.00622.52
7.4.30.0200.00616.51
7.4.00.0130.00315.29
7.3.330.0000.00513.40
7.3.320.0130.00313.49
7.3.310.0030.00316.59
7.3.300.0070.00016.43
7.3.290.0100.00516.57
7.3.280.0090.00716.57
7.3.270.0110.00817.40
7.3.260.0150.01018.24
7.3.250.0100.01216.67
7.3.240.0070.01416.86
7.3.230.0130.00616.57
7.3.210.0040.01616.77
7.3.200.0060.01719.39
7.3.190.0160.00816.61
7.3.180.0150.00316.71
7.3.170.0130.00516.79
7.3.160.0170.00016.46
7.3.120.0080.01014.93
7.3.110.0110.00615.11
7.3.100.0050.01015.02
7.3.90.0050.00815.14
7.3.80.0040.00914.97
7.3.70.0080.01014.75
7.3.60.0070.01014.97
7.3.50.0050.01215.07
7.3.40.0100.00514.97
7.3.30.0100.00315.05
7.3.20.0030.00916.76
7.3.10.0070.00716.75
7.3.00.0070.00516.62
7.2.330.0040.01516.80
7.2.320.0110.00916.88
7.2.310.0130.01016.94
7.2.300.0080.00916.85
7.2.290.0080.01516.84
7.2.240.0100.00715.20
7.2.230.0080.00915.34
7.2.220.0050.00915.31
7.2.210.0050.00915.34
7.2.200.0110.00615.22
7.2.190.0050.01015.19
7.2.180.0070.00515.21
7.2.170.0060.00815.33
7.2.160.0070.01115.13
7.2.150.0020.01217.13
7.2.140.0030.01316.97
7.2.130.0070.00717.14
7.2.120.0050.01117.12
7.2.110.0070.01017.24
7.2.100.0070.01016.96
7.2.90.0080.00916.91
7.2.80.0030.01117.10
7.2.70.0030.01017.14
7.2.60.0060.01017.19
7.2.50.0100.00617.15
7.2.40.0070.00917.26
7.2.30.0060.00917.10
7.2.20.0020.01017.11
7.2.10.0100.00617.03
7.2.00.0080.00817.91
7.1.330.0070.01015.98
7.1.320.0020.01116.17
7.1.310.0020.01315.99
7.1.300.0060.00716.11
7.1.290.0070.00716.04
7.1.280.0000.01116.08
7.1.270.0040.01315.87
7.1.260.0040.00916.07
7.1.250.0070.01015.87
7.1.200.0080.00416.00
7.1.100.0040.00818.13
7.1.70.0000.01317.47
7.1.60.0030.01719.40
7.1.50.0070.01817.18
7.1.00.0070.06022.45
7.0.200.0100.00616.68
7.0.140.0000.07722.00
7.0.70.0100.07021.73
7.0.60.0030.07321.77
7.0.50.0070.08722.12
7.0.40.0000.08720.11
7.0.30.0000.08720.13
7.0.20.0130.07320.07
7.0.10.0130.07720.05
7.0.00.0030.08320.18
5.6.280.0070.07320.92
5.6.220.0130.08020.50
5.6.210.0100.06720.60
5.6.200.0130.06721.13
5.6.190.0130.06321.04
5.6.180.0070.07721.12
5.6.170.0070.08020.93
5.6.160.0170.08020.98
5.6.150.0100.06320.97
5.6.140.0030.04321.04
5.6.130.0030.04321.09
5.6.120.0100.03721.02
5.6.110.0000.04721.03
5.6.100.0030.04320.92
5.6.90.0000.04720.95
5.6.80.0070.05720.48
5.6.70.0130.07720.44
5.6.60.0070.06020.36
5.6.50.0030.08720.45
5.6.40.0170.02720.32
5.6.30.0030.04320.33
5.6.20.0030.04320.40
5.6.10.0070.05720.39
5.6.00.0100.04020.39
5.5.360.0000.09320.43
5.5.350.0070.04720.35
5.5.340.0070.07020.94
5.5.330.0130.08020.89
5.5.320.0130.06320.82
5.5.310.0070.09020.82
5.5.300.0070.07720.85
5.5.290.0070.04020.93
5.5.280.0100.04320.90
5.5.270.0070.04720.78
5.5.260.0130.06020.65
5.5.250.0000.03720.75
5.5.240.0130.03720.33
5.5.230.0100.04720.22
5.5.220.0170.06320.23
5.5.210.0030.05320.22
5.5.200.0070.04320.16
5.5.190.0030.06720.23
5.5.180.0030.04020.29
5.5.160.0030.04020.25
5.5.150.0030.03020.27
5.5.140.0000.03720.16
5.5.130.0070.06020.16
5.5.120.0000.04720.27
5.5.110.0100.04719.98
5.5.100.0100.02320.12
5.5.90.0030.03020.17
5.5.80.0000.03719.96
5.5.70.0000.03720.17
5.5.60.0100.03320.07
5.5.50.0030.05020.10
5.5.40.0070.02720.07
5.5.30.0070.03720.04
5.5.20.0030.04020.07
5.5.10.0070.04320.13
5.5.00.0000.04320.11
5.4.450.0170.03019.47
5.4.440.0000.05019.49
5.4.430.0000.04319.55
5.4.420.0070.03719.44
5.4.410.0000.04319.08
5.4.400.0030.07719.12
5.4.390.0030.08319.12
5.4.380.0100.07719.13
5.4.370.0070.03718.95
5.4.360.0000.05719.18
5.4.350.0100.03319.11
5.4.340.0030.04018.90
5.4.320.0000.03319.25
5.4.310.0000.04019.09
5.4.300.0100.03319.20
5.4.290.0070.06319.18
5.4.280.0030.07319.14
5.4.270.0070.03318.94
5.4.260.0000.04019.08
5.4.250.0070.02719.17
5.4.240.0000.04019.13
5.4.230.0000.03319.02
5.4.220.0100.03319.04
5.4.210.0030.03319.20
5.4.200.0130.02718.94
5.4.190.0070.03319.16
5.4.180.0000.05019.08
5.4.170.0030.04019.04
5.4.160.0030.03019.21
5.4.150.0100.02719.03
5.4.140.0030.03716.50
5.4.130.0030.03316.38
5.4.120.0070.03316.51
5.4.110.0000.03716.50
5.4.100.0030.05316.58
5.4.90.0100.05316.48
5.4.80.0030.07316.54
5.4.70.0030.08016.38
5.4.60.0070.07016.40
5.4.50.0070.07716.36
5.4.40.0070.05016.37
5.4.30.0130.05716.26
5.4.20.0070.07316.30
5.4.10.0030.08016.36
5.4.00.0030.07715.88
5.3.290.0000.04314.75
5.3.280.0030.03714.71
5.3.270.0030.03714.66
5.3.260.0070.03314.55
5.3.250.0000.04714.62
5.3.240.0000.04014.77
5.3.230.0000.03314.55
5.3.220.0000.08314.54
5.3.210.0070.04314.71
5.3.200.0070.06314.54
5.3.190.0070.08014.68
5.3.180.0000.07314.56
5.3.170.0070.07014.67
5.3.160.0000.07314.56
5.3.150.0030.08014.59
5.3.140.0030.08014.59
5.3.130.0030.05714.63
5.3.120.0000.06314.55
5.3.110.0100.07714.63
5.3.100.0100.07313.98
5.3.90.0070.07014.17
5.3.80.0000.08313.96
5.3.70.0000.05714.10
5.3.60.0100.07014.05
5.3.50.0070.07713.87
5.3.40.0100.06714.03
5.3.30.0070.07013.94
5.3.20.0030.06713.80
5.3.10.0170.05313.74
5.3.00.0070.07013.57
5.2.170.0030.06312.39
5.2.160.0030.05312.39
5.2.150.0070.06312.39
5.2.140.0030.05012.39
5.2.130.0000.06312.39
5.2.120.0100.05312.39
5.2.110.0070.06012.39
5.2.100.0030.06012.39
5.2.90.0000.05012.39
5.2.80.0000.04012.39
5.2.70.0000.06712.39
5.2.60.0000.05712.39
5.2.50.0030.05312.39
5.2.40.0030.06012.39
5.2.30.0070.05012.39
5.2.20.0030.06012.39
5.2.10.0030.06312.39
5.2.00.0000.06712.39
5.1.60.0030.05312.39
5.1.50.0070.05012.39
5.1.40.0000.05712.39
5.1.30.0030.06012.39
5.1.20.0000.05712.39
5.1.10.0030.05312.39
5.1.00.0030.04712.39
5.0.50.0000.03712.39
5.0.40.0000.05012.39
5.0.30.0030.06712.39
5.0.20.0000.03312.39
5.0.10.0000.04012.39
5.0.00.0000.05312.39
4.4.90.0100.02712.39
4.4.80.0000.03712.39
4.4.70.0000.03712.39
4.4.60.0070.02312.39
4.4.50.0030.03312.39
4.4.40.0030.04712.39
4.4.30.0000.04012.39
4.4.20.0030.03712.39
4.4.10.0070.03312.39
4.4.00.0030.03712.39
4.3.110.0000.03712.39
4.3.100.0000.03012.39
4.3.90.0000.03712.39
4.3.80.0000.05012.39
4.3.70.0000.02312.39
4.3.60.0000.03312.39
4.3.50.0000.03712.39
4.3.40.0070.04712.39
4.3.30.0030.03012.39
4.3.20.0000.03012.39
4.3.10.0030.03312.39
4.3.00.0070.02312.39

preferences:
49.17 ms | 400 KiB | 5 Q