3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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' )); }
based on ct7FP

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.3.10.0130.00316.32
7.3.00.0100.01016.34
7.2.130.0150.00016.41
7.2.120.0190.01216.98
7.2.110.0090.00916.40
7.2.100.0170.00616.78
7.2.90.0130.01016.60
7.2.80.0160.00316.53
7.2.70.0170.00416.46
7.2.60.0130.01116.27
7.2.50.0170.00316.79
7.2.40.0100.01616.45
7.2.30.0110.00716.67
7.2.20.0190.01117.01
7.2.10.0090.01916.89
7.2.00.0100.00818.01
7.1.250.0100.00715.38
7.1.100.0070.00417.88
7.1.70.0000.01616.88
7.1.60.0030.02019.50
7.1.50.0040.00716.86
7.1.00.0030.09322.35
7.0.200.0570.00914.82
7.0.140.0070.07322.17
7.0.60.0070.08719.87
7.0.50.0070.07017.88
7.0.40.0100.08020.40
7.0.30.0330.06020.15
7.0.20.0230.07020.13
7.0.10.0070.07020.09
7.0.00.0000.04320.22
5.6.280.0000.09320.84
5.6.210.0030.04020.50
5.6.200.0070.09018.14
5.6.190.0000.05720.67
5.6.180.0370.07720.50
5.6.170.0230.06320.55
5.6.160.0000.04720.45
5.6.150.0170.07318.25
5.6.140.0030.05018.15
5.6.130.0030.04018.16
5.6.120.0000.09321.16
5.6.110.0070.07720.98
5.6.100.0000.04320.91
5.6.90.0030.09321.05
5.6.80.0070.08020.43
5.6.70.3870.04020.41
5.5.350.0030.08320.46
5.5.340.0100.08017.94
5.5.330.0070.07720.31
5.5.320.0000.08720.29
5.5.310.0170.04320.41
5.5.300.0030.06718.04
5.5.290.0000.08717.96
5.5.280.0030.06320.70
5.5.270.0000.07720.79
5.5.260.0130.08020.89
5.5.250.0230.06320.61
5.5.240.0230.07320.20
5.4.450.0970.07019.62
5.4.440.0430.05319.18
5.4.430.0930.05719.16
5.4.420.0500.04719.34
5.4.410.0970.05019.48
5.4.400.0200.05718.55
5.4.390.0230.05318.78
5.4.380.0200.05318.61
5.4.370.0200.05318.52
5.4.360.0270.04318.60
5.4.350.0230.05318.78
5.4.340.0200.06018.56
5.4.320.0230.05718.57
5.4.310.0100.06318.69
5.4.300.0200.05318.66
5.4.290.0200.05018.51
5.4.280.0100.06318.60
5.4.270.0200.04718.48
5.4.260.0300.04018.54
5.4.250.0130.06018.70
5.4.240.0200.05318.75
5.4.230.0130.06318.75
5.4.220.0200.05318.73
5.4.210.0170.06018.77
5.4.200.0130.05316.52
5.4.190.0230.05018.53
5.4.180.0300.05318.46
5.4.170.0270.05318.72
5.4.160.0330.03718.68
5.4.150.0300.04018.61
5.4.140.0100.05716.47
5.4.130.0030.06316.24
5.4.120.0100.06016.31
5.4.110.0270.04316.22
5.4.100.0300.04716.30
5.4.90.0270.04716.18
5.4.80.0300.05016.21
5.4.70.0200.05016.22
5.4.60.0170.05316.29
5.4.50.0230.04316.31
5.4.40.0130.05716.28
5.4.30.0170.05016.40
5.4.20.0170.05316.43
5.4.10.0200.05016.43
5.4.00.0270.04715.91
5.3.290.0230.05014.65
5.3.280.0200.05014.80
5.3.270.0030.06714.81
5.3.260.0170.05714.67
5.3.250.0330.04714.71
5.3.240.0130.05714.67
5.3.230.0170.05314.64
5.3.220.0200.05014.63
5.3.210.0230.04714.60
5.3.200.0130.06314.62
5.3.190.0300.04314.59
5.3.180.0200.04714.75
5.3.170.0270.06014.73
5.3.160.0200.05314.59
5.3.150.0270.07014.78
5.3.140.0300.07314.57
5.3.130.0200.06314.57
5.3.120.0130.05714.60
5.3.110.0100.06314.60
5.3.100.0200.05314.09
5.3.90.0100.05714.05
5.3.80.0200.04714.05
5.3.70.0100.06014.14
5.3.60.0100.06014.03
5.3.50.0170.05013.96
5.3.40.0200.05013.99
5.3.30.0100.05714.03
5.3.20.0170.05013.76
5.3.10.1030.05313.70
5.3.00.0130.05313.69
5.2.170.0070.05311.19
5.2.160.0100.04011.23
5.2.150.0170.03711.10
5.2.140.0070.05011.18
5.2.130.0100.04311.06
5.2.120.0100.04311.11
5.2.110.0170.03311.07
5.2.100.0130.04311.02
5.2.90.0070.04311.07
5.2.80.0130.04011.08
5.2.70.0070.04711.07
5.2.60.0170.03711.09
5.2.50.0170.03710.98
5.2.40.0100.03711.03
5.2.30.0100.04011.01
5.2.20.0030.04310.95
5.2.10.0130.03710.91
5.2.00.0130.04010.78
5.1.60.0100.03010.09
5.1.50.0130.04010.06
5.1.40.0070.0379.93
5.1.30.0070.04010.39
5.1.20.0030.04310.51
5.1.10.0130.03010.05
5.1.00.0030.04010.09
5.0.50.0030.0308.61
5.0.40.0070.0308.41
5.0.30.0070.0438.30
5.0.20.0070.0278.39
5.0.10.0030.0308.15
5.0.00.0030.0438.34
4.4.90.0070.0205.83
4.4.80.0070.0205.88
4.4.70.0100.0175.88
4.4.60.0030.0235.81
4.4.50.0030.0235.91
4.4.40.0030.0375.88
4.4.30.0100.0175.91
4.4.20.0030.0235.94
4.4.10.0070.0205.95
4.4.00.0030.0375.84
4.3.110.0030.0235.82
4.3.100.0100.0175.84
4.3.90.0070.0205.79
4.3.80.0070.0335.80
4.3.70.0030.0235.79
4.3.60.0030.0305.79
4.3.50.0030.0275.82
4.3.40.0030.0405.82
4.3.30.0070.0204.54
4.3.20.0030.0274.61
4.3.10.0000.0274.57
4.3.00.0130.0237.11