3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Potherca\Example\TypeHints; class Example { public static function typeHintMissing($subject) { return $subject; } public static function typeHintCallable(callable $subject) { return $subject; } public static function typeHintClosure(\Closure $subject) { return $subject; } public function __invoke($subject) { return $subject; } } $output = <<<'TXT' ================================================================================ (%d) %s : %s callable : %s __invoke : %s closure : %s TXT; $example = new Example(); $callables = array( 1 => 'foo', 2 => 'trim', 3 => '\Potherca\Example\TypeHints\Example::typeHintMissing', 4 => array('\Potherca\Example\TypeHints\Example', 'typeHintMissing'), 5 => array($example, 'typeHintMissing'), 6 => $example, 7 => function ($subject) {return $subject;}, ); array_walk($callables, function ($callable, $key) use ($output) { $is_callable = is_callable($callable); $is_invoke = method_exists($callable, '__invoke'); $is_closure = $callable instanceof \Closure; if ($is_callable === true) { /** @noinspection VariableFunctionsUsageInspection */ call_user_func($callable, 'foo'); Example::typeHintCallable($callable); } if ($is_closure === true) { Example::typeHintClosure($callable); } if ($is_invoke === true) { $callable('foo'); } vprintf($output, array( 'key' => $key, 'type' => gettype($callable), 'value' => str_replace(array("\n", ' '), '', var_export($callable, true)), 'is_callable' => var_export($is_callable, true), 'is_invoke' => var_export($is_invoke, true), 'is_closure' => var_export($is_closure, true), )); });

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.4.120.0140.00620.49
8.4.110.0110.01022.48
8.4.100.0140.00718.13
8.4.90.0120.00820.60
8.4.80.0030.00618.86
8.4.70.0130.00818.88
8.4.60.0140.00618.63
8.4.50.0100.01118.42
8.4.40.0150.00417.70
8.4.30.0040.00417.94
8.4.20.0070.01319.44
8.4.10.0100.00619.43
8.3.250.0120.00818.82
8.3.240.0160.00416.79
8.3.230.0110.00816.86
8.3.220.0110.00718.93
8.3.210.0080.01116.95
8.3.200.0040.00516.78
8.3.190.0050.00417.24
8.3.180.0070.00218.93
8.3.170.0160.00318.84
8.3.160.0030.00618.55
8.3.150.0090.00919.14
8.3.140.0060.00920.59
8.3.130.0080.00018.57
8.3.120.0060.00319.08
8.3.110.0120.00320.94
8.3.100.0040.01424.06
8.3.90.0040.00426.77
8.3.80.0030.00716.88
8.3.70.0120.00616.63
8.3.60.0100.00717.00
8.3.50.0140.00317.51
8.3.40.0140.00718.84
8.3.30.0090.00618.84
8.3.20.0050.00320.31
8.3.10.0040.00423.70
8.3.00.0060.00323.64
8.2.290.0100.00916.93
8.2.280.0100.01018.62
8.2.270.0100.01016.80
8.2.260.0090.00917.29
8.2.250.0060.00316.72
8.2.240.0000.00818.98
8.2.230.0080.00022.58
8.2.220.0090.00037.54
8.2.210.0100.00326.77
8.2.200.0090.00017.00
8.2.190.0040.01116.75
8.2.180.0120.00618.50
8.2.170.0150.00019.09
8.2.160.0070.01022.96
8.2.150.0060.00325.66
8.2.140.0050.00324.66
8.2.130.0050.00326.16
8.2.120.0090.00019.61
8.2.110.0030.00622.25
8.2.100.0080.00417.81
8.2.90.0040.00419.35
8.2.80.0000.00918.05
8.2.70.0090.00017.75
8.2.60.0000.00917.80
8.2.50.0040.00418.10
8.2.40.0000.00822.33
8.2.30.0040.00419.27
8.2.20.0090.00018.16
8.2.10.0000.00718.09
8.2.00.0000.00718.03
8.1.330.0110.00721.99
8.1.320.0090.01018.25
8.1.310.0060.00316.94
8.1.300.0110.00817.97
8.1.290.0060.00318.88
8.1.280.0140.00325.92
8.1.270.0080.00022.05
8.1.260.0110.00726.35
8.1.250.0000.00828.09
8.1.240.0050.00323.84
8.1.230.0000.01119.00
8.1.220.0030.00617.88
8.1.210.0040.00418.77
8.1.200.0080.00317.48
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0040.00418.59
8.1.160.0040.00419.01
8.1.150.0080.00018.85
8.1.140.0000.00817.77
8.1.130.0030.00318.98
8.1.120.0040.00417.40
8.1.110.0060.00317.50
8.1.100.0000.00817.48
8.1.90.0060.00317.50
8.1.80.0030.00617.45
8.1.70.0000.00817.52
8.1.60.0040.00417.65
8.1.50.0000.00817.59
8.1.40.0080.00017.49
8.1.30.0000.00817.54
8.1.20.0050.00317.75
8.1.10.0040.00417.59
8.1.00.0000.00817.52
8.0.300.0000.01118.77
8.0.290.0040.00416.75
8.0.280.0070.00018.48
8.0.270.0000.00717.29
8.0.260.0070.00019.05
8.0.250.0000.00616.98
8.0.240.0000.00717.02
8.0.230.0000.00817.04
8.0.220.0000.00717.04
8.0.210.0000.00716.99
8.0.200.0000.00617.02
8.0.190.0000.00817.03
8.0.180.0030.00517.01
8.0.170.0070.00317.07
8.0.160.0030.00316.95
8.0.150.0000.00716.98
8.0.140.0070.00016.84
8.0.130.0030.00313.38
8.0.120.0000.00717.01
8.0.110.0000.00817.04
8.0.100.0000.00816.86
8.0.90.0000.00716.92
8.0.80.0040.01816.96
8.0.70.0000.00716.84
8.0.60.0000.00716.99
8.0.50.0050.00316.99
8.0.30.0120.00917.18
8.0.20.0110.01117.40
8.0.10.0070.00017.06
8.0.00.0090.00916.85
7.4.330.0060.00016.71
7.4.320.0000.00716.45
7.4.300.0040.00416.54
7.4.290.0040.00316.47
7.4.280.0000.00716.61
7.4.270.0000.00816.63
7.4.260.0000.00716.61
7.4.250.0030.00416.38
7.4.240.0040.00416.54
7.4.230.0030.00316.72
7.4.220.0070.01116.58
7.4.210.0070.00816.60
7.4.200.0000.00716.52
7.4.160.0070.00916.45
7.4.150.0120.00817.40
7.4.140.0080.01117.86
7.4.130.0060.01216.43
7.4.120.0130.00716.63
7.4.110.0070.01516.43
7.4.100.0090.00916.56
7.4.90.0090.01116.58
7.4.80.0130.01019.39
7.4.70.0060.01216.39
7.4.60.0130.00316.38
7.4.50.0090.00616.43
7.4.40.0170.00016.25
7.4.30.0070.01016.54
7.4.00.0030.01314.91
7.3.330.0000.00613.48
7.3.320.0060.00013.32
7.3.310.0000.00716.49
7.3.300.0030.00316.35
7.3.290.0000.00716.41
7.3.280.0080.00816.45
7.3.270.0090.01217.40
7.3.260.0080.01116.39
7.3.250.0120.00716.59
7.3.240.0140.00616.47
7.3.230.0070.01316.46
7.3.210.0150.00316.54
7.3.200.0090.00916.39
7.3.190.0110.00716.48
7.3.180.0140.00716.50
7.3.170.0100.00616.54
7.3.160.0130.00316.36
7.2.330.0140.00316.56
7.2.320.0030.01916.72
7.2.310.0030.01316.75
7.2.300.0100.00616.76
7.2.290.0090.00916.47
7.2.60.0140.00716.20
7.2.50.0080.00516.96
7.1.200.0060.00615.78
7.1.110.0510.01316.48
7.1.100.0490.00616.46
7.1.90.0320.01615.91
7.1.80.0440.00316.02
7.1.70.0320.00815.30
7.1.60.0500.01733.36
7.1.50.0690.00733.02
7.1.40.0810.01032.69
7.1.30.0720.01432.61
7.1.20.0550.01632.81
7.1.10.0370.00914.70
7.1.00.0100.00714.83
7.0.250.0660.01115.78
7.0.240.0430.01015.99
7.0.230.0360.01315.93
7.0.220.0350.01015.68
7.0.210.0350.00314.80
7.0.200.0730.01314.73
7.0.190.0580.01215.04
7.0.180.0520.01914.32
7.0.170.0340.00714.54
7.0.160.0540.00314.45
7.0.150.0470.00714.55
7.0.140.0370.01014.51
7.0.130.0330.01514.82
7.0.120.0260.01314.70
7.0.110.0410.01414.55
7.0.100.0250.01214.71
7.0.90.0390.01614.47
7.0.80.0360.00714.68
7.0.70.0310.01114.50
7.0.60.0500.00314.40
7.0.50.0380.00314.46
7.0.40.0260.01014.42
7.0.30.0270.00714.60
7.0.20.0210.01214.40
7.0.10.0230.01314.87
7.0.00.0240.00914.40
5.6.300.0100.06320.82
5.6.290.0130.05420.78
5.6.280.0170.07620.99
5.6.270.0130.07420.80
5.6.260.0130.05720.80
5.6.250.0100.06420.78
5.6.240.0170.07820.76
5.6.230.0070.06420.88
5.6.220.0100.05420.73
5.6.210.0170.08320.77
5.6.200.0070.07520.79
5.6.190.0220.05420.97
5.6.180.0030.06420.90
5.6.170.0060.06820.75
5.6.160.0100.05720.76
5.6.150.0100.06220.74
5.6.140.0190.06620.78
5.6.130.0100.05820.75
5.6.120.0160.06920.93
5.6.110.0130.06020.93
5.6.100.0160.06920.84
5.6.90.0130.05520.74
5.6.80.0100.05320.14
5.6.70.0100.05620.13
5.6.60.0130.07220.29
5.6.50.0070.05920.36
5.6.40.0100.05320.09
5.6.30.0070.06120.22
5.6.20.0100.05820.07
5.6.10.0170.06720.07
5.6.00.0100.05220.07
5.5.380.0160.05917.54
5.5.370.0130.06317.44
5.5.360.0100.06117.55
5.5.350.0070.06617.52
5.5.340.0130.05417.75
5.5.330.0190.04918.07
5.5.320.0130.05118.01
5.5.310.0070.06618.02
5.5.300.0090.07518.03
5.5.290.0140.05417.95
5.5.280.0070.07418.13
5.5.270.0230.06918.02
5.5.260.0070.06318.03
5.5.250.0130.07617.82
5.5.240.0180.04617.10
5.5.230.0130.05317.18
5.5.220.0100.05317.41
5.5.210.0140.04817.32
5.5.200.0130.05017.15
5.5.190.0030.07317.38
5.5.180.0210.05217.47
5.5.160.0030.07017.39
5.5.150.0140.06517.39
5.5.140.0100.05417.35
5.5.130.0070.05617.16
5.5.120.0030.05817.48
5.5.110.0200.04317.38
5.5.100.0170.04717.28
5.5.90.0260.03517.04
5.5.80.0160.04617.20
5.5.70.0100.05417.25
5.5.60.0160.04917.27
5.5.50.0140.04717.28
5.5.40.0000.06117.25
5.5.30.0140.05017.37
5.5.20.0100.05917.37
5.5.10.0030.06917.26
5.5.00.0220.04117.26
5.4.450.0200.05719.32
5.4.440.0130.06319.47
5.4.430.0070.05819.34
5.4.420.0040.06519.27
5.4.410.0030.08519.20
5.4.400.0040.05818.93
5.4.390.0120.05318.84
5.4.380.0000.06319.11
5.4.370.0160.04619.01
5.4.360.0100.05418.93
5.4.350.0070.05618.84
5.4.340.0100.06319.02
5.4.320.0040.06018.97
5.4.310.0280.03519.16
5.4.300.0110.05219.00
5.4.290.0130.05019.15
5.4.280.0160.04918.82
5.4.270.0130.04918.98
5.4.260.0160.04519.02
5.4.250.0160.04819.11
5.4.240.0060.05518.92
5.4.230.0070.05619.03
5.4.220.0070.05719.01
5.4.210.0030.05919.23
5.4.200.0100.05119.23
5.4.190.0220.04518.86
5.4.180.0070.05619.02
5.4.170.0190.06418.91
5.4.160.0100.05218.93
5.4.150.0140.05018.91
5.4.140.0070.05816.57
5.4.130.0030.07616.77
5.4.120.0380.04516.44
5.4.110.0250.05716.59
5.4.100.0070.05216.71
5.4.90.0070.07316.63
5.4.80.0140.04416.46
5.4.70.0070.05116.68
5.4.60.0160.04816.68
5.4.50.0190.03816.70
5.4.40.0170.04316.64
5.4.30.0100.04816.40
5.4.20.0030.05316.63
5.4.10.0100.05016.67
5.4.00.0030.05415.96
5.3.290.0190.04514.57
5.3.280.0100.04914.92
5.3.270.0170.05314.85
5.3.260.0110.05314.51
5.3.250.0100.05214.83
5.3.240.0030.07014.69
5.3.230.0100.07214.50
5.3.220.0140.04814.88
5.3.210.0130.06614.78
5.3.200.0060.07414.48
5.3.190.0100.04814.47
5.3.180.0100.04714.89
5.3.170.0070.05414.61
5.3.160.0030.06414.47
5.3.150.0130.04814.77
5.3.140.0160.06014.65
5.3.130.0160.04314.84
5.3.120.0100.05114.88
5.3.110.0200.06314.86
5.3.100.0110.05314.23
5.3.90.0060.05214.09
5.3.80.0100.04814.26
5.3.70.0100.05014.25
5.3.60.0100.04614.08
5.3.50.0100.04614.29
5.3.40.0170.04014.18
5.3.30.0130.04213.93
5.3.20.0070.06113.92
5.3.10.0070.04613.88
5.3.00.0100.06713.87
5.2.170.0100.03711.07
5.2.160.0070.03911.29
5.2.150.0030.04411.25
5.2.140.0060.04111.12
5.2.130.0090.05411.25
5.2.120.0030.04211.33
5.2.110.0130.04811.22
5.2.100.0130.05111.31
5.2.90.0030.05911.08
5.2.80.0200.04611.30
5.2.70.0100.05511.23
5.2.60.0000.04711.29
5.2.50.0070.05611.13
5.2.40.0090.04811.11
5.2.30.0130.04611.12
5.2.20.0070.04111.16
5.2.10.0070.04810.73
5.2.00.0170.04710.71
5.1.60.0100.04410.20
5.1.50.0060.0489.88
5.1.40.0130.02910.09
5.1.30.0030.03910.46
5.1.20.0100.03210.34
5.1.10.0060.03410.36
5.1.00.0060.03310.26
5.0.50.0030.0309.47
5.0.40.0060.0259.47
5.0.30.0100.0369.47
5.0.20.0000.0319.47
5.0.10.0060.0309.47
5.0.00.0060.0409.47
4.4.90.0080.0199.47
4.4.80.0040.0219.47
4.4.70.0000.0259.47
4.4.60.0030.0219.47
4.4.50.0040.0219.47
4.4.40.0100.0369.47
4.4.30.0060.0199.47
4.4.20.0060.0199.47
4.4.10.0080.0179.47
4.4.00.0000.0359.47
4.3.110.0090.0169.47
4.3.100.0100.0199.47
4.3.90.0000.0239.47
4.3.80.0030.0329.47
4.3.70.0030.0309.47
4.3.60.0060.0189.47
4.3.50.0030.0229.47
4.3.40.0030.0329.47
4.3.30.0000.0249.47
4.3.20.0040.0219.47
4.3.10.0000.0249.47
4.3.00.0000.0249.47

preferences:
179.94 ms | 403 KiB | 5 Q