3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reflectCallable($arg): ReflectionFunctionAbstract { if (is_array($arg)) { $ref = new ReflectionMethod(...$arg); } elseif (is_callable($arg)) { $ref = new ReflectionFunction($arg); } return $ref; } function definedFunc(Foo $foo) {} $callable = function(Foo $foo) {}; class Bar { public function baz(Foo $foo) {} } foreach (['definedFunc', $callable, ['Bar', 'baz']] as $callable) { $reflected = reflectCallable($callable); if ((string) $reflected->getParameters()[0]->getType() === 'Foo') { echo 'Callable takes Foo', PHP_EOL; } }

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.70.0150.00316.50
8.3.60.0190.00018.40
8.3.50.0150.00318.16
8.3.40.0040.01118.64
8.3.30.0140.00418.64
8.3.20.0080.00018.73
8.3.10.0080.00023.26
8.3.00.0000.00721.68
8.2.190.0100.00716.58
8.2.180.0150.00316.32
8.2.170.0090.00922.96
8.2.160.0070.00719.33
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0070.00026.16
8.2.120.0030.00619.77
8.2.110.0060.00321.07
8.2.100.0030.00717.84
8.2.90.0080.00017.91
8.2.80.0030.00617.97
8.2.70.0050.00317.75
8.2.60.0040.00417.93
8.2.50.0050.00318.07
8.2.40.0080.00019.95
8.2.30.0040.00418.03
8.2.20.0000.00718.04
8.2.10.0000.00718.02
8.2.00.0040.00419.39
8.1.280.0100.01025.92
8.1.270.0000.00920.77
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0060.00322.55
8.1.230.0070.00420.90
8.1.220.0000.00917.74
8.1.210.0040.00418.85
8.1.200.0030.00617.35
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0040.00418.91
8.1.160.0080.00018.89
8.1.150.0050.00318.83
8.1.140.0040.00420.80
8.1.130.0000.00817.42
8.1.120.0000.00817.38
8.1.110.0000.00717.41
8.1.100.0060.00617.34
8.1.90.0040.00417.55
8.1.80.0000.01017.52
8.1.70.0090.00017.45
8.1.60.0050.00717.61
8.1.50.0030.00617.58
8.1.40.0000.00817.52
8.1.30.0040.00417.61
8.1.20.0040.00417.70
8.1.10.0020.00517.62
8.1.00.0000.00717.51
8.0.300.0080.00319.78
8.0.290.0090.00316.63
8.0.280.0000.00818.39
8.0.270.0000.00717.26
8.0.260.0030.00616.79
8.0.250.0000.00716.95
8.0.240.0000.00716.86
8.0.230.0000.00716.98
8.0.220.0040.00416.94
8.0.210.0040.00416.80
8.0.200.0000.00816.96
8.0.190.0070.00016.97
8.0.180.0000.00816.82
8.0.170.0050.00316.98
8.0.160.0000.00816.91
8.0.150.0030.00516.71
8.0.140.0030.00516.85
8.0.130.0000.00513.39
8.0.120.0040.00416.85
8.0.110.0000.00916.77
8.0.100.0000.00716.95
8.0.90.0060.00317.02
8.0.80.0070.00816.91
8.0.70.0030.00516.96
8.0.60.0070.00016.95
8.0.50.0070.00016.77
8.0.30.0090.01017.21
8.0.20.0110.01017.40
8.0.10.0030.00416.96
8.0.00.0080.00916.98
7.4.330.0020.00215.55
7.4.320.0040.00416.62
7.4.300.0030.00416.51
7.4.290.0000.00816.53
7.4.280.0000.00716.55
7.4.270.0070.00016.43
7.4.260.0030.00316.56
7.4.250.0030.00316.59
7.4.240.0030.00316.49
7.4.230.0080.00016.67
7.4.220.0000.00816.46
7.4.210.0090.00716.48
7.4.200.0030.00316.53
7.4.160.0090.00816.64
7.4.140.0100.00817.86
7.4.130.0130.01316.53
7.4.120.0110.00816.61
7.4.110.0130.01316.28
7.4.100.0160.00816.60
7.4.90.0070.01016.62
7.4.80.0170.00019.39
7.4.70.0000.01716.52
7.4.60.0100.00916.61
7.4.50.0090.00616.29
7.4.40.0110.00616.45
7.4.00.0050.01015.16
7.3.330.0000.00513.34
7.3.320.0050.00013.27
7.3.310.0000.00716.27
7.3.300.0000.00716.38
7.3.290.0070.00016.42
7.3.280.0060.01516.42
7.3.260.0060.01316.38
7.3.240.0110.00816.41
7.3.230.0090.00916.37
7.3.210.0030.01616.43
7.3.200.0090.00616.57
7.3.190.0090.00616.40
7.3.180.0090.00616.48
7.3.170.0100.00716.62
7.3.160.0100.00616.57
7.3.120.0080.00314.82
7.3.110.0030.01614.63
7.3.100.0130.00314.92
7.3.90.0030.00915.02
7.3.80.0070.00314.96
7.3.70.0090.00614.93
7.3.60.0130.00014.67
7.3.50.0030.00614.75
7.3.40.0140.00014.78
7.3.30.0040.00414.95
7.3.20.0040.00416.33
7.3.10.0070.00416.79
7.3.00.0020.00916.77
7.2.330.0130.01016.64
7.2.320.0000.01716.79
7.2.310.0060.01216.52
7.2.300.0060.01216.58
7.2.290.0050.01016.62
7.2.250.0030.01715.16
7.2.240.0100.01015.09
7.2.230.0090.00915.08
7.2.220.0000.01415.27
7.2.210.0030.01315.25
7.2.200.0040.01415.18
7.2.190.0150.00015.04
7.2.180.0030.00915.16
7.2.170.0030.00615.08
7.2.130.0090.00316.79
7.2.120.0070.00716.64
7.2.110.0060.00617.09
7.2.100.0030.00916.98
7.2.90.0130.00715.83
7.2.80.0080.00916.02
7.2.70.1480.00916.04
7.2.60.1420.00816.14
7.2.50.1520.00916.05
7.2.40.1500.01015.98
7.2.30.1320.00716.23
7.2.20.1500.00315.93
7.2.10.1350.00815.91
7.2.00.1270.00916.14
7.1.330.0070.00715.58
7.1.320.0030.00715.89
7.1.310.0080.00615.89
7.1.300.0040.00415.69
7.1.290.0030.01015.83
7.1.280.0070.00715.86
7.1.270.0000.01315.85
7.1.260.0030.00615.58
7.1.250.0040.00415.75
7.1.210.0650.01614.04
7.1.200.0240.00314.02
7.1.190.2840.00313.95
7.1.180.3280.01614.05
7.1.170.2660.00013.78
7.1.160.3040.01314.04
7.1.150.2540.00714.09
7.1.140.2500.00714.12
7.1.130.2750.01313.70
7.1.120.2850.00313.91
7.1.110.2390.00614.00
7.1.100.2820.00713.68
7.1.90.3760.00013.96
7.1.80.3530.01014.02
7.1.70.3440.01313.79
7.1.60.3150.01931.87
7.1.50.4590.01631.87
7.1.40.5800.01731.69
7.1.30.4730.01331.76
7.1.20.4630.01031.98
7.1.10.4850.00313.93
7.1.00.3250.00313.86

preferences:
44.6 ms | 401 KiB | 5 Q