3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace { function callable_equals(){ $strict = false; $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; } class Foo{static function bar(){}} } namespace A\b\C\d { class Foo{static function bar(){}} } namespace { 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'] )); }

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.56
8.3.50.0100.00822.00
8.3.40.0140.00418.79
8.3.30.0090.00919.15
8.3.20.0140.00420.20
8.3.10.0050.00321.95
8.3.00.0070.01019.38
8.2.180.0000.01518.53
8.2.170.0090.01322.96
8.2.160.0140.00720.44
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00419.77
8.2.110.0070.00322.24
8.2.100.0090.00317.75
8.2.90.0040.00419.39
8.2.80.0000.00917.97
8.2.70.0000.00817.63
8.2.60.0030.00517.93
8.2.50.0050.00318.07
8.2.40.0030.00619.95
8.2.30.0000.00818.23
8.2.20.0000.00817.90
8.2.10.0040.00418.08
8.2.00.0030.00517.79
8.1.280.0110.00425.92
8.1.270.0100.00720.78
8.1.260.0000.00826.35
8.1.250.0100.00728.09
8.1.240.0000.00923.92
8.1.230.0110.00019.10
8.1.220.0040.00417.76
8.1.210.0040.00418.77
8.1.200.0030.00617.23
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0070.00320.42
8.1.160.0000.00722.16
8.1.150.0050.00218.91
8.1.140.0070.00017.36
8.1.130.0000.00717.90
8.1.120.0000.00917.52
8.1.110.0050.00217.47
8.1.100.0040.00417.50
8.1.90.0000.00717.48
8.1.80.0040.00417.51
8.1.70.0030.00317.47
8.1.60.0080.00317.65
8.1.50.0040.00417.53
8.1.40.0000.00817.45
8.1.30.0050.00317.63
8.1.20.0040.00417.64
8.1.10.0030.00617.59
8.1.00.0000.00817.54
8.0.300.0040.00418.77
8.0.290.0070.00016.88
8.0.280.0030.00318.40
8.0.270.0050.00217.38
8.0.260.0060.00017.34
8.0.250.0030.00317.06
8.0.240.0000.00717.03
8.0.230.0030.00316.94
8.0.220.0000.00716.96
8.0.210.0070.00017.02
8.0.200.0000.00816.90
8.0.190.0030.00617.04
8.0.180.0070.00017.07
8.0.170.0000.00817.02
8.0.160.0030.00617.07
8.0.150.0070.00016.94
8.0.140.0030.00317.01
8.0.130.0050.00013.41
8.0.120.0040.00416.96
8.0.110.0040.00417.06
8.0.100.0040.00416.86
8.0.90.0070.00016.78
8.0.80.0040.01116.92
8.0.70.0040.00417.01
8.0.60.0040.00416.85
8.0.50.0050.00216.96
8.0.30.0120.01217.29
8.0.20.0120.00917.40
8.0.10.0070.00016.92
8.0.00.0070.01016.84
7.4.330.0050.00015.14
7.4.320.0000.00716.54
7.4.300.0000.00616.61
7.4.290.0070.00016.59
7.4.280.0000.00816.66
7.4.270.0040.00416.68
7.4.260.0050.00216.53
7.4.250.0050.00216.41
7.4.240.0020.00616.64
7.4.230.0000.00816.55
7.4.220.0130.01316.41
7.4.210.0040.01416.59
7.4.200.0000.00816.67
7.4.160.0050.01016.45
7.4.150.0170.00017.40
7.4.140.0110.00817.86
7.4.130.0100.00816.54
7.4.120.0030.01416.58
7.4.110.0100.00716.63
7.4.100.0100.01416.52
7.4.90.0000.01716.64
7.4.80.0110.00719.39
7.4.70.0170.00716.70
7.4.60.0090.00916.43
7.4.50.0040.00416.25
7.4.40.0170.00316.67
7.4.30.0090.01016.41
7.4.00.0000.00815.11
7.3.330.0000.00713.42
7.3.320.0040.00913.38
7.3.310.0050.00216.27
7.3.300.0030.00316.39
7.3.290.0000.00716.25
7.3.280.0060.01016.40
7.3.270.0080.00917.40
7.3.260.0040.01816.64
7.3.250.0100.00816.50
7.3.240.0110.00716.40
7.3.230.0040.01616.41
7.3.210.0100.01316.50
7.3.200.0110.00619.39
7.3.190.0080.00716.51
7.3.180.0060.01016.49
7.3.170.0070.01616.61
7.3.160.0030.01416.45
7.2.330.0130.01216.68
7.2.320.0090.00616.64
7.2.310.0080.01016.51
7.2.300.0100.01016.57
7.2.290.0130.01016.82
7.2.60.0050.00516.61
7.2.00.0000.01019.67
7.1.200.0070.00715.79
7.1.100.0000.01118.24
7.1.70.0040.00416.72
7.1.60.0140.01019.50
7.1.50.0150.00816.78
7.1.00.0100.08322.42
7.0.200.0830.00314.89
7.0.140.0100.05321.99
7.0.60.0070.04319.88
7.0.50.0030.07317.89
7.0.40.0070.04320.14
7.0.30.0230.04320.09
7.0.20.0170.07020.33
7.0.10.0230.06720.15
7.0.00.0030.07720.46
5.6.280.0000.07720.92
5.6.210.0030.04020.62
5.6.200.0030.07318.14
5.6.190.0100.07720.77
5.6.180.0230.08320.47
5.6.170.0330.07020.47
5.6.160.0070.06320.57
5.6.150.0000.04318.19
5.6.140.0100.03318.19
5.6.130.0070.08318.17
5.6.120.0030.04721.00
5.6.110.0070.09021.16
5.6.100.0130.04321.06
5.6.90.0070.07021.13
5.6.80.0070.04320.46
5.6.70.0270.07020.38
5.5.350.0130.08020.41
5.5.340.0030.07318.08
5.5.330.0000.04720.18
5.5.320.0130.05020.45
5.5.310.0170.06320.35
5.5.300.0030.04317.98
5.5.290.0130.04317.96
5.5.280.0070.07020.79
5.5.270.0200.07020.70
5.5.260.0030.07320.87
5.5.250.0100.05320.61
5.5.240.0130.08020.14
5.4.450.4370.04719.40
5.4.440.0000.05319.40
5.4.430.1370.06319.29
5.4.420.3970.03719.43
5.4.410.3730.04719.31
5.4.400.4600.03719.11
5.4.390.4500.03719.11
5.4.380.3630.04019.16
5.4.370.3970.04019.11
5.4.360.3670.03719.01
5.4.350.3830.03319.21
5.4.340.4130.03719.16
5.4.320.4300.04019.05
5.4.310.4730.04319.15
5.4.300.3500.03019.00
5.4.290.3470.03319.07
5.4.280.3530.04018.98
5.4.270.4500.04019.15
5.4.260.3800.03719.14
5.4.250.3900.04719.17
5.4.240.3870.03019.05
5.4.230.4070.03319.11
5.4.220.4570.03018.94
5.4.210.4200.03319.15
5.4.200.4500.03719.15
5.4.190.4570.03019.09
5.4.180.4500.04019.14
5.4.170.0070.08019.10
5.4.160.3770.03718.87
5.4.150.4670.03319.04
5.4.140.4600.03716.47
5.4.130.4600.03316.55
5.4.120.4100.03016.48
5.4.110.4630.03016.52
5.4.100.3900.03316.52
5.4.90.3230.04016.52
5.4.80.3300.03716.25
5.4.70.1830.03016.50
5.4.60.0030.03716.21
5.4.50.3670.02716.16
5.4.40.3800.03716.17
5.4.30.3670.03316.45
5.4.20.3230.03716.50
5.4.10.3570.03716.49
5.4.00.3600.03315.90
5.3.290.4070.03314.72
5.3.280.4470.04014.65
5.3.270.3730.03314.65
5.3.260.0130.06014.62
5.3.250.4070.02714.76
5.3.240.4370.03314.64
5.3.230.4570.03714.50
5.3.220.4670.03014.50
5.3.210.4700.03014.63
5.3.200.4730.04014.58
5.3.190.3670.03714.63
5.3.180.3330.03314.74
5.3.170.3570.03714.57
5.3.160.0030.03714.59
5.3.150.0070.03314.57
5.3.140.3630.03314.63
5.3.130.3570.03714.71
5.3.120.3570.03314.70
5.3.110.3700.03314.56
5.3.100.3930.04014.10
5.3.90.3970.03314.18
5.3.80.4130.03014.06
5.3.70.4430.03014.04
5.3.60.4770.03713.90
5.3.50.4570.03714.02
5.3.40.3600.03314.01
5.3.30.4070.03713.80
5.3.20.4000.03713.70
5.3.10.4070.03713.82
5.3.00.3700.04013.65
5.2.170.3970.03311.23
5.2.160.3300.03011.08
5.2.150.3170.03711.11
5.2.140.3170.03711.08
5.2.130.3330.02711.09
5.2.120.3170.03010.96
5.2.110.3500.02711.18
5.2.100.3500.02710.95
5.2.90.3270.03310.98
5.2.80.3400.02710.97
5.2.70.3470.03011.10
5.2.60.3270.03310.99
5.2.50.3270.03010.96
5.2.40.2400.01310.97
5.2.30.2770.02711.12
5.2.20.2570.03310.90
5.2.10.2800.03310.81
5.2.00.2700.02310.80
5.1.60.2830.0239.99
5.1.50.2600.02310.04
5.1.40.2930.0239.97
5.1.30.2570.02310.23
5.1.20.2570.02710.23
5.1.10.2930.02710.16
5.1.00.2700.02710.09
5.0.50.1730.0278.38
5.0.40.1530.0178.41
5.0.30.1400.0308.13
5.0.20.1800.0208.18
5.0.10.1830.0208.14
5.0.00.1870.0278.30
4.4.90.1570.0176.08
4.4.80.1700.0206.08
4.4.70.1500.0106.08
4.4.60.1600.0176.08
4.4.50.1700.0136.08
4.4.40.1470.0236.08
4.4.30.1400.0176.08
4.4.20.1300.0206.08
4.4.10.1730.0176.08
4.4.00.1870.0206.08
4.3.110.1470.0206.08
4.3.100.1430.0136.08
4.3.90.1400.0136.08
4.3.80.1670.0236.08
4.3.70.1730.0176.08
4.3.60.1600.0136.08
4.3.50.1670.0136.08
4.3.40.1800.0276.08
4.3.30.1000.0236.08
4.3.20.0830.0206.08
4.3.10.0870.0236.08
4.3.00.0900.0236.08

preferences:
54 ms | 401 KiB | 5 Q