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($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.0110.00418.18
8.3.50.0110.00721.92
8.3.40.0070.01318.96
8.3.30.0170.00319.20
8.3.20.0050.00320.21
8.3.10.0040.00421.75
8.3.00.0070.01319.38
8.2.180.0120.00418.16
8.2.170.0150.00722.96
8.2.160.0000.01520.44
8.2.150.0150.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0000.00819.89
8.2.110.0060.00322.27
8.2.100.0040.00817.75
8.2.90.0080.00019.14
8.2.80.0040.00417.97
8.2.70.0030.00517.50
8.2.60.0060.00318.04
8.2.50.0050.00318.07
8.2.40.0040.00419.95
8.2.30.0000.00718.18
8.2.20.0040.00417.78
8.2.10.0040.00418.22
8.2.00.0040.00417.82
8.1.280.0090.01225.92
8.1.270.0100.01020.65
8.1.260.0000.00826.35
8.1.250.0070.01128.09
8.1.240.0060.00323.89
8.1.230.0070.00419.12
8.1.220.0000.00817.79
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0080.00017.00
8.1.180.0030.00618.10
8.1.170.0050.00320.50
8.1.160.0000.00722.13
8.1.150.0000.00718.80
8.1.140.0040.00417.48
8.1.130.0030.00317.89
8.1.120.0070.00417.52
8.1.110.0000.00717.49
8.1.100.0000.00717.55
8.1.90.0000.00717.39
8.1.80.0000.00817.39
8.1.70.0050.00217.40
8.1.60.0040.00817.62
8.1.50.0040.00417.56
8.1.40.0060.00317.43
8.1.30.0040.00417.64
8.1.20.0000.00717.60
8.1.10.0050.00217.54
8.1.00.0040.00417.57
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0000.00718.50
8.0.270.0040.00417.29
8.0.260.0000.00717.29
8.0.250.0070.00016.93
8.0.240.0040.00417.05
8.0.230.0030.00317.12
8.0.220.0030.00316.86
8.0.210.0000.00717.04
8.0.200.0030.00317.01
8.0.190.0040.00416.99
8.0.180.0040.00417.03
8.0.170.0040.00417.04
8.0.160.0040.00417.00
8.0.150.0000.00716.98
8.0.140.0000.00717.00
8.0.130.0060.00013.48
8.0.120.0050.00316.83
8.0.110.0070.00016.95
8.0.100.0070.00016.81
8.0.90.0070.00017.02
8.0.80.0120.00416.97
8.0.70.0070.00016.98
8.0.60.0000.00717.03
8.0.50.0050.00316.98
8.0.30.0080.01317.17
8.0.20.0090.01017.44
8.0.10.0050.00317.18
8.0.00.0120.00816.97
7.4.330.0000.00615.03
7.4.320.0030.00316.57
7.4.300.0000.00616.45
7.4.290.0040.00416.54
7.4.280.0040.00416.63
7.4.270.0030.00316.63
7.4.260.0040.00416.42
7.4.250.0070.00016.49
7.4.240.0030.00516.53
7.4.230.0030.00316.52
7.4.220.0060.01216.52
7.4.210.0040.01416.62
7.4.200.0000.00816.39
7.4.160.0000.01616.54
7.4.150.0120.00617.40
7.4.140.0100.00817.86
7.4.130.0100.00816.53
7.4.120.0170.00316.55
7.4.110.0070.01016.59
7.4.100.0100.00716.53
7.4.90.0130.00316.39
7.4.80.0030.01719.39
7.4.70.0060.01516.47
7.4.60.0060.01016.45
7.4.50.0030.00516.50
7.4.40.0110.00816.34
7.4.30.0100.01016.47
7.4.00.0000.01214.87
7.3.330.0040.00313.36
7.3.320.0080.00413.42
7.3.310.0040.00416.30
7.3.300.0050.00316.27
7.3.290.0000.00716.38
7.3.280.0110.00816.37
7.3.270.0120.00617.40
7.3.260.0070.01016.52
7.3.250.0120.00616.53
7.3.240.0100.00716.54
7.3.230.0100.01016.51
7.3.210.0060.01116.33
7.3.200.0100.01319.39
7.3.190.0120.00316.55
7.3.180.0030.01416.57
7.3.170.0140.00716.61
7.3.160.0090.00616.41
7.3.10.0030.00716.36
7.3.00.0030.01016.83
7.2.330.0120.00616.80
7.2.320.0030.01416.59
7.2.310.0060.01216.52
7.2.300.0080.00816.81
7.2.290.0160.00716.57
7.2.130.0060.00616.69
7.2.120.0030.01316.98
7.2.110.0090.00616.90
7.2.100.0140.00316.94
7.2.90.0040.01616.82
7.2.80.0180.00317.08
7.2.70.0100.01316.94
7.2.60.0060.00617.00
7.2.50.0070.00716.67
7.2.40.0000.01417.09
7.2.30.0070.00317.10
7.2.20.0040.01117.13
7.2.10.0060.00917.18
7.2.00.0120.00016.79
7.1.250.0060.00315.78
7.1.200.0000.01215.78
7.1.100.0000.01118.09
7.1.70.0060.00617.01
7.1.60.0090.01519.50
7.1.50.0000.01116.86
7.1.00.0000.09722.28
7.0.200.0610.00614.69
7.0.140.0030.06321.99
7.0.60.0130.07719.93
7.0.50.0100.05017.86
7.0.40.0070.04019.96
7.0.30.0330.07320.09
7.0.20.0130.08720.24
7.0.10.0370.07020.24
7.0.00.0100.08720.07
5.6.280.0030.09021.18
5.6.210.0030.08320.68
5.6.200.0070.06718.18
5.6.190.0170.07020.55
5.6.180.0230.04720.65
5.6.170.0570.06320.71
5.6.160.0100.08320.52
5.6.150.0200.06018.14
5.6.140.0070.03718.13
5.6.130.0100.08018.18
5.6.120.0170.05720.99
5.6.110.0130.07720.91
5.6.100.0130.07721.03
5.6.90.0100.05721.02
5.6.80.0070.03720.53
5.5.350.0130.07720.35
5.5.340.0170.06717.93
5.5.330.0070.04720.32
5.5.320.0130.07020.28
5.5.310.0330.05720.34
5.5.300.0100.03717.94
5.5.290.0100.07017.97
5.5.280.0170.04020.70
5.5.270.0100.08020.78
5.5.260.0200.06720.88
5.5.250.0100.07320.68
5.5.240.0100.06020.36
5.4.450.0730.05719.26
5.4.440.0130.05019.34
5.4.430.1070.04719.61
5.4.420.0870.05319.58
5.4.410.0800.05718.98
5.4.400.0270.04318.73
5.4.390.0230.05318.73
5.4.380.0170.05718.61
5.4.370.0200.05718.57
5.4.360.0230.05318.63
5.4.350.0000.07318.75
5.4.340.0170.05318.66
5.4.320.0230.05718.61
5.4.310.0300.04318.61
5.4.300.0270.05718.49
5.4.290.0230.05718.74
5.4.280.0330.05318.75
5.4.270.0330.06318.63
5.4.260.0270.05018.60
5.4.250.0300.04718.70
5.4.240.0130.06318.73
5.4.230.0130.05718.74
5.4.220.0230.06018.76
5.4.210.0200.05318.60
5.4.200.0230.04316.64
5.4.190.0230.05018.56
5.4.180.0170.06718.75
5.4.170.0200.05318.53
5.4.160.0170.08018.55
5.4.150.0270.07018.54
5.4.140.0270.05016.35
5.4.130.0170.05316.30
5.4.120.0300.06016.23
5.4.110.0170.05316.27
5.4.100.0130.05316.29
5.4.90.0230.04316.29
5.4.80.0200.05016.43
5.4.70.0300.04316.20
5.4.60.0230.04316.28
5.4.50.0130.06016.32
5.4.40.0170.06316.41
5.4.30.0100.05316.19
5.4.20.0270.04316.27
5.4.10.0100.05716.31
5.4.00.0130.05015.71
5.3.290.0130.06014.88
5.3.280.0270.04714.80
5.3.270.0130.06014.81
5.3.260.0170.06014.63
5.3.250.0200.07014.74
5.3.240.0330.06014.64
5.3.230.0200.07314.71
5.3.220.0270.06714.68
5.3.210.0270.07314.68
5.3.200.0330.06714.68
5.3.190.0200.07014.62
5.3.180.0200.07314.79
5.3.170.0300.06714.70
5.3.160.0130.06714.71
5.3.150.0230.04714.74
5.3.140.0130.05714.67
5.3.130.0200.06014.55
5.3.120.0130.06714.66
5.3.110.0370.06314.66
5.3.100.0170.05714.11
5.3.90.0200.07714.06
5.3.80.0070.06714.03
5.3.70.0130.05714.05
5.3.60.0200.05014.14
5.3.50.0200.04714.03
5.3.40.0100.06013.96
5.3.30.0100.06014.02
5.3.20.0200.05013.76
5.3.10.0130.06013.68
5.3.00.0170.05013.70
5.2.170.0130.04311.30
5.2.160.0170.04011.09
5.2.150.0130.04711.09
5.2.140.0170.04011.12
5.2.130.0230.03311.11
5.2.120.0030.05311.08
5.2.110.0100.04711.08
5.2.100.0030.05711.07
5.2.90.0100.04711.15
5.2.80.0170.04011.05
5.2.70.0130.04311.15
5.2.60.0130.04011.19
5.2.50.0130.04311.02
5.2.40.0170.04710.90
5.2.30.0170.06011.03
5.2.20.0130.05311.07
5.2.10.0170.04310.97
5.2.00.0300.04010.74
5.1.60.0230.03710.01
5.1.50.0170.03310.00
5.1.40.0130.0339.96
5.1.30.0100.04010.38
5.1.20.0200.03310.50
5.1.10.0130.03310.08
5.1.00.0170.03710.13
5.0.50.0070.0338.64
5.0.40.0070.0308.41
5.0.30.0070.0578.25
5.0.20.0000.0378.32
5.0.10.0030.0338.29
5.0.00.0100.0478.24
4.4.90.0030.0275.92
4.4.80.0070.0235.89
4.4.70.0100.0205.89
4.4.60.0100.0205.86
4.4.50.0100.0205.91
4.4.40.0030.0405.89
4.4.30.0100.0205.82
4.4.20.0130.0275.94
4.4.10.0030.0375.89
4.4.00.0070.0475.93
4.3.110.0100.0275.83
4.3.100.0130.0205.81
4.3.90.0070.0205.79
4.3.80.0070.0375.77
4.3.70.0100.0205.79
4.3.60.0100.0205.77
4.3.50.0030.0275.80
4.3.40.0070.0335.73
4.3.30.0070.0174.54
4.3.20.0070.0204.61
4.3.10.0070.0274.62
4.3.00.0100.0237.11

preferences:
48.52 ms | 401 KiB | 5 Q