3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * make sure the setA and setB are the same */ function isSame($setA, $setB) { if (!is_array($setA) && !is_array($setB)) { return $setA == $setB; } if (!is_array($setA) || !is_array($setB)) { return false; } $keys = array_intersect_key($setA, $setB); if ((count($keys) != count($setA)) || (count($keys) != count($setB))) { return false; } foreach ($keys as $k => $v) { if (!isSame($setA[$k], $setB[$k])) { return false; } } return true; } /* * return true if setA has all capabilities in setB. Here the comparison is on actual capabilities, and nothing * fancy like number of capabilities or a weighted sum of capabilities. In other words, return true if setB is a * subset of setA. * * NOTE: This function does not validate if the inputs are really capability lists. * * @param array setA - master list to compare against * @param array setB - subset to be compared * * @return bool */ function hasAllCapabilities($setA, $setB) { if(!isset($setA)) $setA = array(); if(!is_array($setA)) $setA = array($setA); if(!isset($setB)) $setB = array(); if(!is_array($setB)) $setB = array($setB); foreach ($setB as $k=>$v) { if (array_key_exists($k, $setA)) { if (!isSame($setA[$k], $v)) { return false; } } else { return false; } } return true; } $a=array(101=>array(1,2,3)); $b=array(101=>array(1,2,3)); echo hasAllCapabilities($a, $b);

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.00716.63
8.3.50.0030.01122.77
8.3.40.0140.00718.79
8.3.30.0150.00419.16
8.3.20.0040.00420.10
8.3.10.0040.00423.57
8.3.00.0040.00419.38
8.2.180.0110.00716.50
8.2.170.0140.00322.96
8.2.160.0170.00020.20
8.2.150.0030.00624.18
8.2.140.0080.00024.66
8.2.130.0030.00626.16
8.2.120.0070.00020.83
8.2.110.0040.00419.30
8.2.100.0120.00017.75
8.2.90.0040.00419.30
8.2.80.0000.00917.97
8.2.70.0030.00617.63
8.2.60.0030.00617.68
8.2.50.0080.00018.07
8.2.40.0040.00419.89
8.2.30.0070.00018.20
8.2.20.0040.00417.73
8.2.10.0000.00818.00
8.2.00.0050.00217.68
8.1.280.0120.00325.92
8.1.270.0040.00423.96
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0110.00820.87
8.1.230.0080.00417.52
8.1.220.0040.00417.74
8.1.210.0000.00918.77
8.1.200.0000.00817.22
8.1.190.0060.00317.35
8.1.180.0000.00718.10
8.1.170.0080.00018.49
8.1.160.0080.00022.13
8.1.150.0070.00018.89
8.1.140.0060.00317.45
8.1.130.0070.00017.91
8.1.120.0000.00717.40
8.1.110.0030.00617.49
8.1.100.0040.00417.34
8.1.90.0040.00417.36
8.1.80.0000.00817.41
8.1.70.0050.00217.38
8.1.60.0040.00417.46
8.1.50.0000.00817.48
8.1.40.0000.00817.56
8.1.30.0000.00917.52
8.1.20.0080.00017.55
8.1.10.0020.00617.54
8.1.00.0060.00317.56
8.0.300.0070.00018.77
8.0.290.0060.00316.75
8.0.280.0040.00418.40
8.0.270.0070.00017.18
8.0.260.0030.00317.33
8.0.250.0050.00316.97
8.0.240.0040.00416.98
8.0.230.0040.00416.94
8.0.220.0030.00516.85
8.0.210.0000.00816.86
8.0.200.0030.00716.89
8.0.190.0080.00016.84
8.0.180.0000.01116.83
8.0.170.0000.00816.92
8.0.160.0040.00416.89
8.0.150.0070.00016.73
8.0.140.0030.00416.70
8.0.130.0050.00013.36
8.0.120.0040.00416.75
8.0.110.0000.00716.91
8.0.100.0030.00516.69
8.0.90.0000.00716.87
8.0.80.0100.00716.89
8.0.70.0080.00016.89
8.0.60.0070.00016.86
8.0.50.0000.00716.71
8.0.30.0140.00616.96
8.0.20.0050.01617.40
8.0.10.0040.00416.80
8.0.00.0070.01016.89
7.4.330.0050.00015.15
7.4.320.0070.00016.63
7.4.300.0030.00316.50
7.4.290.0000.00716.52
7.4.280.0050.00516.63
7.4.270.0070.00016.50
7.4.260.0000.00716.63
7.4.250.0040.00416.50
7.4.240.0030.00416.59
7.4.230.0030.00316.44
7.4.220.0080.01016.68
7.4.210.0000.01416.67
7.4.200.0040.00416.61
7.4.160.0030.01316.67
7.4.150.0100.01317.40
7.4.140.0130.00517.86
7.4.130.0130.00416.57
7.4.120.0030.01416.62
7.4.110.0140.01116.33
7.4.100.0160.00616.55
7.4.90.0110.00916.60
7.4.80.0080.01219.39
7.4.70.0100.01016.50
7.4.60.0070.01116.43
7.4.50.0040.00016.42
7.4.40.0030.01316.47
7.4.30.0070.01016.36
7.4.00.0040.01415.11
7.3.330.0060.00013.25
7.3.320.0050.00013.24
7.3.310.0030.00316.24
7.3.300.0030.00316.36
7.3.290.0050.00916.43
7.3.280.0080.01216.38
7.3.270.0130.00617.40
7.3.260.0140.00316.40
7.3.250.0100.00716.55
7.3.240.0100.00716.42
7.3.230.0160.00016.66
7.3.210.0100.01016.47
7.3.200.0000.01619.39
7.3.190.0090.00616.34
7.3.180.0120.00316.39
7.3.170.0130.00616.66
7.3.160.0100.00616.41
7.2.330.0130.01016.83
7.2.320.0030.01416.82
7.2.310.0160.00616.85
7.2.300.0030.01416.74
7.2.290.0100.01316.83
7.2.00.0320.00619.15
7.1.200.0060.00915.98
7.1.100.0000.01118.06
7.1.70.0000.00816.92
7.1.60.0090.01519.40
7.1.50.0100.01317.05
7.1.00.0000.07722.45
7.0.200.0000.00916.89
7.0.140.0000.07722.00
7.0.60.0100.08019.98
7.0.50.0100.08017.89
7.0.40.0070.09020.23
7.0.30.0330.03720.39
7.0.20.0230.06020.10
7.0.10.0070.08020.12
7.0.00.0030.05020.05
5.6.280.0000.07720.89
5.6.210.0170.06720.73
5.6.200.0100.03718.16
5.6.190.0030.04720.69
5.6.180.0300.07720.46
5.6.170.0230.05020.47
5.6.160.0000.09320.55
5.6.150.0100.03318.18
5.6.140.0070.04318.15
5.6.130.0000.08718.16
5.6.120.0000.05721.01
5.6.110.0070.08720.99
5.6.100.0070.04021.10
5.6.90.0030.04721.14
5.6.80.0030.04320.52
5.5.350.0030.04320.42
5.5.340.0100.06017.98
5.5.330.0130.06020.35
5.5.320.0030.05020.32
5.5.310.0270.07320.35
5.5.300.0030.05717.98
5.5.290.0070.08017.98
5.5.280.0070.08320.88
5.5.270.0070.07320.87
5.5.260.0130.07320.77
5.5.250.0030.04320.69
5.5.240.3530.04320.13
5.4.450.0370.04719.33
5.4.440.0230.04719.46
5.4.430.0270.03719.40
5.4.420.0430.03719.52
5.4.410.0370.05019.41
5.4.400.0370.04718.95
5.4.390.0070.05318.84
5.4.380.0200.05018.54
5.4.370.0270.06318.61
5.4.360.0200.05718.68
5.4.350.0230.05018.68
5.4.340.0200.05018.51
5.4.320.0100.03212.50
5.4.310.0070.03612.50
5.4.300.0100.03212.51
5.4.290.0050.03912.51
5.4.280.0080.03312.40
5.4.270.0060.03612.40
5.4.260.0080.03612.40
5.4.250.0070.03712.40
5.4.240.0040.03712.40
5.4.230.0070.03612.39
5.4.220.0050.03612.40
5.4.210.0090.03612.40
5.4.200.0020.04112.39
5.4.190.0080.03312.39
5.4.180.0030.04112.39
5.4.170.0040.03712.40
5.4.160.0070.03412.39
5.4.150.0040.03712.39
5.4.140.0070.03512.07
5.4.130.0040.03712.06
5.4.120.0060.03512.02
5.4.110.0050.03612.01
5.4.100.0050.03612.02
5.4.90.0040.03812.02
5.4.80.0050.03712.02
5.4.70.0030.03812.01
5.4.60.0060.03412.01
5.4.50.0040.03612.01
5.4.40.0070.03312.00
5.4.30.0090.03212.00
5.4.20.0050.03512.00
5.4.10.0040.03612.00
5.4.00.0060.03511.48
5.3.290.0060.03912.80
5.3.280.0070.04212.70
5.3.270.0050.04012.73
5.3.260.0090.03612.72
5.3.250.0070.03912.72
5.3.240.0100.03312.72
5.3.230.0080.03612.70
5.3.220.0090.03412.68
5.3.210.0070.03812.68
5.3.200.0060.04712.68
5.3.190.0060.03812.68
5.3.180.0080.04112.67
5.3.170.0050.03812.67
5.3.160.0040.03812.67
5.3.150.0090.03412.68
5.3.140.0120.03212.66
5.3.130.0080.05012.66
5.3.120.0070.05612.66
5.3.110.0050.04012.66
5.3.100.0070.03612.13
5.3.90.0110.03212.10
5.3.80.0060.04612.10
5.3.70.0070.05012.10
5.3.60.0060.04012.08
5.3.50.0060.03712.03
5.3.40.0060.03612.04
5.3.30.0050.03611.99
5.3.20.0120.03011.77
5.3.10.0080.03211.74
5.3.00.0050.03711.73
5.2.170.0060.0319.24
5.2.160.0050.0299.24
5.2.150.0060.0299.24
5.2.140.0050.0309.23
5.2.130.0050.0369.19
5.2.120.0050.0299.20
5.2.110.0050.0299.20
5.2.100.0040.0309.19
5.2.90.0040.0309.19
5.2.80.0060.0299.19
5.2.70.0030.0319.18
5.2.60.0030.0329.15
5.2.50.0050.0309.12
5.2.40.0030.0309.09
5.2.30.0090.0269.06
5.2.20.0060.0279.06
5.2.10.0050.0278.96
5.2.00.0060.0278.82
5.1.60.0040.0238.11
5.1.50.0030.0268.10
5.1.40.0040.0248.08
5.1.30.0050.0258.43
5.1.20.0050.0268.45
5.1.10.0050.0258.18
5.1.00.0050.0248.18
5.0.50.0030.0216.68
5.0.40.0030.0196.54
5.0.30.0040.0306.35
5.0.20.0040.0196.31
5.0.10.0040.0196.29
5.0.00.0030.0316.28
4.4.90.0060.0154.78
4.4.80.0040.0144.75
4.4.70.0020.0164.75
4.4.60.0020.0164.75
4.4.50.0020.0174.77
4.4.40.0050.0234.71
4.4.30.0020.0164.75
4.4.20.0050.0134.84
4.4.10.0040.0174.85
4.4.00.0020.0254.76
4.3.110.0010.0174.67
4.3.100.0020.0154.67
4.3.90.0050.0124.63
4.3.80.0030.0244.59
4.3.70.0040.0134.63
4.3.60.0020.0154.63
4.3.50.0040.0144.63
4.3.40.0030.0234.53
4.3.30.0020.0163.33
4.3.20.0020.0163.31
4.3.10.0040.0143.27
4.3.00.0030.01315.62

preferences:
34.63 ms | 401 KiB | 5 Q