3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace { function callable_equals(){ $strict = true; $callables = func_get_args(); if(is_bool($callables[count($callables) - 1])){ $strict = $callables[count($callables) - 1]; $callables = array_splice($callables, 0, -1); } $normalizeCallable = function(callable $callable){ if(is_string($callable)){ $callable = strtolower($callable); $pieces = explode("::", $callable); if(count($pieces) == 2){ return [$pieces[0], $pieces[1]]; } return $callable; } if(is_string($callable[0])){ $callable[0] = strtolower($callable[0]); } $callable[1] = strtolower($callable[1]); return $callable; }; if(count($callables) < 2){ trigger_error("callable_equals() requires at least 2 callables for comparison.", E_USER_WARNING); return null; } foreach($callables as $i => $callable){ if(!is_callable($callable)){ trigger_error("Argument " . ($i + 1) . " is not a callable.", E_USER_WARNING); return null; }else{ $callables[$i] = $normalizeCallable($callable); } } $callable = array_shift($callables); while($callables){ if($strict ? $callable !== $callables[0] : $callable != $callables[0]) return false; $callable = array_shift($callables); } return true; } } namespace A\b\C\d { class Foo{static function bar(){}} } namespace { class Foo{static function bar(){}} var_dump(callable_equals( ['Foo', 'bar'], 'foo::BAR' )); var_dump(callable_equals( ['A\\b\\C\\d\\Foo', 'bAr'], 'a\\B\\c\\D\\FoO::bar', ['A\\b\\c\\d\\foo', 'BAR'] )); var_dump(callable_equals( [new ArrayObject, 'append'], [new ArrayObject, 'append'] )); }

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.60.0100.00318.43
8.3.50.0100.01018.06
8.3.40.0140.00718.58
8.3.30.0100.01018.89
8.3.20.0000.00820.18
8.3.10.0050.00321.76
8.3.00.0050.00319.51
8.2.180.0130.00318.16
8.2.170.0140.00019.09
8.2.160.0110.00722.96
8.2.150.0040.00425.66
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0060.00319.79
8.2.110.0090.00022.11
8.2.100.0060.00617.75
8.2.90.0090.00019.17
8.2.80.0050.00317.97
8.2.70.0000.00817.47
8.2.60.0060.00317.91
8.2.50.0000.00818.07
8.2.40.0000.00819.88
8.2.30.0050.00318.22
8.2.20.0050.00317.74
8.2.10.0050.00318.11
8.2.00.0000.00817.75
8.1.280.0090.00925.92
8.1.270.0000.00822.05
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0030.00623.84
8.1.230.0090.00319.01
8.1.220.0080.00017.80
8.1.210.0080.00018.77
8.1.200.0030.00617.35
8.1.190.0080.00017.35
8.1.180.0000.00818.10
8.1.170.0040.00420.44
8.1.160.0040.00422.04
8.1.150.0000.00719.03
8.1.140.0070.00017.48
8.1.130.0000.00717.79
8.1.120.0080.00317.54
8.1.110.0070.00017.54
8.1.100.0040.00417.42
8.1.90.0000.00717.36
8.1.80.0020.00517.39
8.1.70.0000.00717.47
8.1.60.0040.00817.61
8.1.50.0000.00817.62
8.1.40.0090.00017.61
8.1.30.0000.00817.64
8.1.20.0000.00717.68
8.1.10.0060.00317.58
8.1.00.0040.00417.59
8.0.300.0000.00818.77
8.0.290.0000.00716.75
8.0.280.0070.00018.39
8.0.270.0030.00317.16
8.0.260.0070.00017.20
8.0.250.0030.00317.04
8.0.240.0030.00317.05
8.0.230.0050.00217.10
8.0.220.0040.00416.93
8.0.210.0080.00017.00
8.0.200.0000.00716.89
8.0.190.0000.00917.03
8.0.180.0000.00817.04
8.0.170.0050.00317.05
8.0.160.0000.00817.03
8.0.150.0050.00216.82
8.0.140.0000.00816.91
8.0.130.0000.00513.38
8.0.120.0050.00316.85
8.0.110.0040.00417.02
8.0.100.0070.00017.02
8.0.90.0070.00016.94
8.0.80.0060.01016.95
8.0.70.0040.00416.95
8.0.60.0030.00616.86
8.0.50.0000.00717.09
8.0.30.0150.01217.06
8.0.20.0100.01117.40
8.0.10.0000.00717.23
8.0.00.0090.00916.68
7.4.330.0030.00315.03
7.4.320.0030.00316.68
7.4.300.0000.00616.64
7.4.290.0070.00016.63
7.4.280.0060.00316.53
7.4.270.0090.00016.61
7.4.260.0050.00516.43
7.4.250.0070.00016.52
7.4.240.0060.00116.54
7.4.230.0070.00016.61
7.4.220.0100.01016.57
7.4.210.0050.01316.66
7.4.200.0050.00216.42
7.4.160.0100.00616.62
7.4.150.0100.00717.40
7.4.140.0100.00817.86
7.4.130.0100.00916.52
7.4.120.0090.00716.51
7.4.110.0030.01416.62
7.4.100.0130.00716.58
7.4.90.0120.00916.61
7.4.80.0130.00719.39
7.4.70.0180.00016.58
7.4.60.0080.00916.55
7.4.50.0030.00616.37
7.4.40.0060.01316.56
7.4.30.0030.01616.70
7.4.00.0030.01215.02
7.3.330.0030.00313.34
7.3.320.0100.00313.26
7.3.310.0050.00216.35
7.3.300.0000.00716.28
7.3.290.0000.00716.34
7.3.280.0090.01016.41
7.3.270.0140.00317.40
7.3.260.0100.01016.61
7.3.250.0110.00716.58
7.3.240.0100.00616.63
7.3.230.0110.00816.66
7.3.210.0040.01116.64
7.3.200.0130.01019.39
7.3.190.0030.01216.41
7.3.180.0070.01016.71
7.3.170.0100.01116.57
7.3.160.0030.01316.54
7.3.120.0110.00714.93
7.3.110.0070.01114.77
7.3.100.0000.01414.91
7.3.90.0090.00315.09
7.3.80.0130.00014.83
7.3.70.0080.00415.02
7.3.60.0140.00415.06
7.3.50.0030.00614.91
7.3.40.0060.00314.74
7.3.30.0110.00014.89
7.3.20.0090.00616.62
7.3.10.0000.00916.68
7.3.00.0030.00716.74
7.2.330.0070.01316.77
7.2.320.0130.00316.78
7.2.310.0060.01116.83
7.2.300.0080.01416.80
7.2.290.0070.01716.48
7.2.250.0100.00715.25
7.2.240.0060.01314.85
7.2.230.0070.00715.25
7.2.220.0110.00314.86
7.2.210.0060.00614.89
7.2.200.0090.00615.00
7.2.190.0090.00015.16
7.2.180.0110.00315.15
7.2.170.0090.00614.77
7.2.60.0070.00716.82
7.2.00.0080.00419.34
7.1.330.0070.00715.94
7.1.320.0100.00715.93
7.1.310.0050.00515.92
7.1.300.0060.00615.85
7.1.290.0000.01515.55
7.1.280.0120.00315.79
7.1.270.0030.00615.82
7.1.260.0120.00315.91
7.1.200.0100.00315.96
7.1.100.0000.01018.27
7.1.70.0040.00417.01
7.1.60.0100.01419.50
7.1.50.0080.00317.01
7.1.00.0100.09022.54
7.0.200.0600.00414.45
7.0.140.0000.08021.98
7.0.60.0000.08319.96
7.0.50.0070.08017.90
7.0.40.0030.09020.25
7.0.30.0430.04020.09
7.0.20.0270.07720.30
7.0.10.0170.05320.25
7.0.00.0130.03720.18
5.6.280.0130.08020.88
5.6.210.0070.03720.48
5.6.200.0170.07718.19
5.6.190.0000.04720.41
5.6.180.0230.07320.33
5.6.170.0300.04320.54
5.6.160.0030.05020.54
5.6.150.0100.03718.18
5.6.140.0100.07318.16
5.6.130.0170.07718.18
5.6.120.0100.03321.04
5.6.110.0130.08721.07
5.6.100.0170.08020.91
5.6.90.0300.06020.99
5.6.80.0070.03720.46
5.6.70.3430.03020.39
5.5.350.0170.07720.51
5.5.340.0030.06317.92
5.5.330.0030.04720.57
5.5.320.0330.05320.36
5.5.310.0430.05320.50
5.5.300.0100.04017.94
5.5.290.0100.07717.93
5.5.280.0130.05720.80
5.5.270.0000.04320.81
5.5.260.0030.04020.89
5.5.250.0200.07020.64
5.5.240.0230.08720.09
5.4.450.0230.05319.37
5.4.440.0870.07019.45
5.4.430.1070.06019.54
5.4.420.0500.05019.15
5.4.410.0930.04719.48
5.4.400.0100.06718.73
5.4.390.0270.05318.63
5.4.380.0230.05318.49
5.4.370.0270.07318.75
5.4.360.0270.05018.75
5.4.350.0230.06318.73
5.4.340.0270.07318.52
5.4.320.0270.05318.74
5.4.310.0270.04718.66
5.4.300.0330.06718.54
5.4.290.0270.06018.54
5.4.280.0200.06718.62
5.4.270.0300.05718.48
5.4.260.0300.05018.69
5.4.250.0130.06318.59
5.4.240.0300.05718.66
5.4.230.0170.06318.61
5.4.220.0130.06318.73
5.4.210.0230.05318.50
5.4.200.0300.04016.63
5.4.190.0170.05318.59
5.4.180.0200.05018.73
5.4.170.0130.06018.58
5.4.160.0100.06318.58
5.4.150.0170.05718.72
5.4.140.0270.06716.31
5.4.130.0130.05016.37
5.4.120.0330.04016.46
5.4.110.0270.05016.36
5.4.100.0130.08016.16
5.4.90.0170.05716.24
5.4.80.0330.05716.22
5.4.70.0270.05016.24
5.4.60.0200.05316.29
5.4.50.0170.05316.16
5.4.40.0200.05716.27
5.4.30.0170.05316.16
5.4.20.0200.05716.22
5.4.10.0300.04016.24
5.4.00.0230.04315.73
5.3.290.0230.05014.77
5.3.280.0270.05314.64
5.3.270.0300.05314.66
5.3.260.0270.04314.66
5.3.250.0170.06014.63
5.3.240.0200.05314.74
5.3.230.0270.05714.81
5.3.220.0170.05014.61
5.3.210.0070.07314.73
5.3.200.0230.06014.74
5.3.190.0300.06714.78
5.3.180.0100.06014.77
5.3.170.0270.04714.75
5.3.160.0170.06014.61
5.3.150.0130.05714.71
5.3.140.0170.06314.77
5.3.130.0270.06714.59
5.3.120.0200.05314.61
5.3.110.0330.04014.78
5.3.100.0130.05714.08
5.3.90.0270.04014.05
5.3.80.0230.04714.26
5.3.70.0170.05714.05
5.3.60.0170.05014.18
5.3.50.0100.05713.95
5.3.40.0200.04714.13
5.3.30.0270.03713.92
5.3.20.0270.06713.74
5.3.10.0270.04013.70
5.3.00.0300.04013.76
5.2.170.0200.03711.11
5.2.160.0200.03711.20
5.2.150.0170.04011.11
5.2.140.0130.04311.09
5.2.130.0170.03711.14
5.2.120.0230.03011.08
5.2.110.0100.04311.07
5.2.100.0170.04311.07
5.2.90.0230.03011.07
5.2.80.0170.04011.07
5.2.70.0200.03711.04
5.2.60.0170.04010.95
5.2.50.0130.04310.97
5.2.40.0130.04711.14
5.2.30.0200.03711.00
5.2.20.0230.03310.93
5.2.10.0130.04010.87
5.2.00.0130.05710.83
5.1.60.0170.04310.11
5.1.50.0100.05010.16
5.1.40.0270.03010.00
5.1.30.0130.04010.36
5.1.20.0100.04010.38
5.1.10.0130.04010.09
5.1.00.0130.04310.21
5.0.50.0100.0308.52
5.0.40.0070.0308.48
5.0.30.0070.0638.27
5.0.20.0130.0338.29
5.0.10.0170.0208.29
5.0.00.0170.0508.23
4.4.90.0170.0235.87
4.4.80.0100.0305.88
4.4.70.0100.0305.89
4.4.60.0000.0405.86
4.4.50.0100.0305.93
4.4.40.0030.0375.92
4.4.30.0030.0275.93
4.4.20.0070.0205.93
4.4.10.0100.0205.93
4.4.00.0070.0335.89
4.3.110.0030.0235.80
4.3.100.0070.0205.87
4.3.90.0070.0305.80
4.3.80.0030.0375.79
4.3.70.0100.0175.84
4.3.60.0130.0135.80
4.3.50.0030.0235.82
4.3.40.0030.0435.83
4.3.30.0100.0234.62
4.3.20.0100.0234.56
4.3.10.0070.0204.55
4.3.00.0070.0237.11

preferences:
60.12 ms | 400 KiB | 5 Q