3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 1, 2, [ [ 'one' => '1', 'two' => 2 ] ] ]; function array_search_recursive_pair(array $array, $key, $value, $strict = false) { foreach (new RecursiveIteratorIterator(new ParentIterator(new RecursiveArrayIterator($array))) as $leaf_array) { if (array_key_exists($key, $leaf_array)) { var_dump($leaf_array); if ($strict && $leaf_array[$key] === $value) { return $leaf_array; } elseif (!$strict && $leaf_array[$key] == $value) { return $leaf_array; } } } return false; } var_dump(array_search_recursive_pair($arr, 'one', 1)); var_dump(array_search_recursive_pair($arr, 'one', 1, true));

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.0070.00718.55
8.3.50.0120.00521.99
8.3.40.0120.00318.67
8.3.30.0040.01119.05
8.3.20.0040.00420.34
8.3.10.0060.00322.01
8.3.00.0080.00022.34
8.2.180.0070.00716.59
8.2.170.0070.00722.96
8.2.160.0070.00720.94
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0090.00917.50
8.2.110.0030.00622.00
8.2.100.0040.00817.84
8.2.90.0040.00419.02
8.2.80.0080.00017.97
8.2.70.0040.00717.47
8.2.60.0050.00317.92
8.2.50.0000.00818.07
8.2.40.0060.00317.92
8.2.30.0040.00417.95
8.2.20.0070.00017.54
8.2.10.0080.00017.61
8.2.00.0070.00017.68
8.1.280.0120.00625.92
8.1.270.0090.00022.19
8.1.260.0030.00626.35
8.1.250.0030.01028.09
8.1.240.0030.00623.96
8.1.230.0080.00318.96
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0050.00317.53
8.1.180.0040.00418.10
8.1.170.0000.00818.59
8.1.160.0000.00722.00
8.1.150.0030.00618.65
8.1.140.0050.00217.41
8.1.130.0000.00717.77
8.1.120.0030.00317.41
8.1.110.0040.00417.39
8.1.100.0030.00317.50
8.1.90.0000.00717.50
8.1.80.0070.00017.37
8.1.70.0030.00317.49
8.1.60.0040.00417.53
8.1.50.0000.00817.43
8.1.40.0030.00517.51
8.1.30.0050.00317.68
8.1.20.0030.00517.58
8.1.10.0000.00917.45
8.1.00.0000.00817.45
8.0.300.0000.00718.77
8.0.290.0070.00017.05
8.0.280.0000.00718.52
8.0.270.0000.00717.15
8.0.260.0060.00016.73
8.0.250.0030.00316.95
8.0.240.0070.00016.88
8.0.230.0000.00716.98
8.0.220.0000.00716.91
8.0.210.0080.00016.90
8.0.200.0000.00716.96
8.0.190.0000.00716.93
8.0.180.0000.00716.95
8.0.170.0040.00416.84
8.0.160.0050.00216.99
8.0.150.0000.00816.81
8.0.140.0040.00416.88
8.0.130.0000.00513.29
8.0.120.0060.00316.81
8.0.110.0040.00416.77
8.0.100.0040.00417.02
8.0.90.0040.00416.87
8.0.80.0060.01516.91
8.0.70.0030.00516.94
8.0.60.0000.00816.91
8.0.50.0020.00516.80
8.0.30.0120.00917.16
8.0.20.0110.00817.40
8.0.10.0040.00417.09
8.0.00.0080.01316.85
7.4.330.0030.00315.00
7.4.320.0030.00316.57
7.4.300.0050.00316.52
7.4.290.0030.00316.37
7.4.280.0000.00816.65
7.4.270.0000.00716.62
7.4.260.0040.00416.52
7.4.250.0070.00016.57
7.4.240.0010.00616.54
7.4.230.0030.00316.62
7.4.220.0030.02216.66
7.4.210.0060.00916.61
7.4.200.0050.00216.73
7.4.190.0050.00316.38
7.4.160.0040.01216.68
7.4.150.0170.00717.40
7.4.140.0130.00517.86
7.4.130.0160.00816.55
7.4.120.0080.01216.60
7.4.110.0300.02416.63
7.4.100.0100.00616.55
7.4.90.0070.01116.44
7.4.80.0030.01316.74
7.4.70.0130.00316.55
7.4.60.0000.01716.42
7.4.50.0000.00516.70
7.4.40.0110.00722.77
7.4.30.0100.00616.60
7.4.00.0030.01415.12
7.3.330.0020.00213.27
7.3.320.0000.00613.21
7.3.310.0000.00716.31
7.3.300.0030.00316.23
7.3.290.0030.01316.28
7.3.280.0080.01016.28
7.3.270.0070.01017.40
7.3.260.0140.00416.47
7.3.250.0080.00916.44
7.3.240.0000.01716.45
7.3.230.0120.00416.39
7.3.210.0190.00316.18
7.3.200.0090.00919.39
7.3.190.0160.00616.52
7.3.180.0060.01616.45
7.3.170.0100.00516.35
7.3.160.0060.01016.66
7.3.120.0030.01415.04
7.3.10.0100.00316.33
7.3.00.0110.00016.54
7.2.330.0090.00816.69
7.2.320.0140.00416.80
7.2.310.0070.01016.47
7.2.300.0100.00716.54
7.2.290.0130.00316.47
7.2.130.0080.00416.70
7.2.120.0040.00816.93
7.2.110.0070.01016.82
7.2.100.0000.00916.77
7.2.90.0060.00916.68
7.2.80.0060.00616.87
7.2.70.0100.00716.93
7.2.60.0100.00516.75
7.2.50.0140.00016.98
7.2.40.0060.00316.84
7.2.30.0060.01016.97
7.2.20.0040.01516.86
7.2.10.0060.00916.72
7.2.00.0110.00416.96
7.1.250.0070.00315.69
7.1.200.0120.00015.60
7.1.70.0000.00717.09
7.1.60.0070.01719.82
7.1.50.0030.01916.57
7.1.00.0130.06722.35
7.0.200.0030.00716.69
7.0.140.0030.07022.21
7.0.60.0100.08019.88
7.0.50.0100.05017.87
7.0.40.0070.07320.11
7.0.30.0330.07720.20
7.0.20.0300.05720.23
7.0.10.0300.08720.25
7.0.00.0130.04320.23
5.6.280.0000.07321.05
5.6.210.0100.07720.73
5.6.200.0030.05318.18
5.6.190.0030.06720.53
5.6.180.3470.04320.47
5.6.170.0370.07720.44
5.6.160.0030.08720.55
5.6.150.0130.07318.15
5.6.140.0100.06318.14
5.6.130.0130.07718.28
5.6.120.0070.08320.89
5.6.110.0130.07720.98
5.6.100.0170.07021.11
5.6.90.0030.05021.00
5.6.80.0030.08720.50
5.6.70.4270.04320.28
5.5.350.0000.07020.32
5.5.340.0070.07318.05
5.5.330.0130.03320.29
5.5.320.0170.04320.25
5.5.310.0430.06320.27
5.5.300.0070.05717.97
5.5.290.0070.07018.04
5.5.280.0070.08720.90
5.5.270.0170.06720.79
5.5.260.0170.07320.77
5.5.250.0130.07720.79
5.5.240.0000.08320.16
5.4.450.1730.04719.31
5.4.440.1700.05319.25
5.4.430.1500.04019.21
5.4.420.1700.04319.11
5.4.410.1730.04019.37
5.4.400.1500.03319.08
5.4.390.1730.03718.91
5.4.380.1870.04018.98
5.4.370.1800.03719.05
5.4.360.1700.05718.93
5.4.350.1700.04019.02
5.4.340.1470.03719.21
5.4.320.1730.04319.21
5.4.310.1600.04019.08
5.4.300.1800.03319.16
5.4.290.1630.04018.85
5.4.280.1700.04019.06
5.4.270.1670.04319.17
5.4.260.1500.03718.77
5.4.250.1500.04018.88
5.4.240.1600.04019.02
5.4.230.1700.04318.74
5.4.220.1770.04319.02
5.4.210.1470.04019.11
5.4.200.1770.03019.07
5.4.190.1700.04318.96
5.4.180.1630.03718.96
5.4.170.1800.04018.85
5.4.160.1530.03018.73
5.4.150.1630.05319.04
5.4.140.1630.04316.46
5.4.130.1600.03316.38
5.4.120.1570.03716.55
5.4.110.0800.04016.28
5.4.100.0030.03316.42
5.4.90.0070.03016.56
5.4.80.0100.02716.52
5.4.70.1470.03316.35
5.4.60.1470.03716.38
5.4.50.1470.03316.55
5.4.40.1830.04316.57
5.4.30.1530.03716.33
5.4.20.1530.04016.43
5.4.10.1530.03716.22
5.4.00.1500.03715.88
5.3.290.1430.03714.61
5.3.280.0000.04014.54
5.3.270.0030.03714.70
5.3.260.0130.03714.70
5.3.250.1470.04314.46
5.3.240.1370.04014.50
5.3.230.1470.05014.56
5.3.220.1800.04014.43
5.3.210.1400.04014.51
5.3.200.1570.03314.62
5.3.190.1600.03314.41
5.3.180.1530.03714.43
5.3.170.1470.04314.62
5.3.160.1470.03314.51
5.3.150.1570.03714.44
5.3.140.1630.04014.41
5.3.130.0730.03714.57
5.3.120.0000.04014.41
5.3.110.0100.03014.53
5.3.100.1700.04014.00
5.3.90.1330.04314.11
5.3.80.1630.04713.85
5.3.70.1500.03314.00
5.3.60.1230.02713.95
5.3.50.1530.03714.04
5.3.40.1530.03313.96
5.3.30.1430.03713.76
5.3.20.1430.03713.67
5.3.10.1770.03713.50
5.3.00.1770.04013.62
5.2.170.1400.05311.08
5.2.160.1300.02711.30
5.2.150.1130.03311.19
5.2.140.1230.03310.99
5.2.130.1430.03710.94
5.2.120.1230.03010.96
5.2.110.1500.02311.15
5.2.100.1530.03011.15
5.2.90.1370.03711.26
5.2.80.1470.03711.11
5.2.70.1130.03310.98
5.2.60.0070.06311.05
5.2.50.0030.06310.85
5.2.40.0000.03011.03
5.2.30.0000.05311.02
5.2.20.0370.05310.97
5.2.10.1200.02710.88
5.2.00.1230.04010.76
5.1.60.1270.0309.96
5.1.50.1170.03310.15
5.1.40.1200.03710.03
5.1.30.1170.03310.42
5.1.20.1030.02010.25
5.1.10.1300.02710.23
5.1.00.1170.0339.96
5.0.50.0530.0238.48
5.0.40.0670.0308.29
5.0.30.0570.0308.14
5.0.20.0500.0178.34
5.0.10.0600.0178.25
5.0.00.0500.0308.08
4.4.90.0670.0278.04
4.4.80.0670.0208.04
4.4.70.0570.0238.04
4.4.60.0500.0138.04
4.4.50.0470.0178.04
4.4.40.0670.0338.04
4.4.30.0600.0238.04
4.4.20.0600.0178.04
4.4.10.0630.0138.04
4.4.00.0630.0278.04
4.3.110.0600.0138.04
4.3.100.0900.0138.04
4.3.90.0700.0108.04
4.3.80.0730.0278.04
4.3.70.0700.0238.04
4.3.60.0670.0138.04
4.3.50.0800.0238.04
4.3.40.0730.0278.04
4.3.30.0400.0278.04
4.3.20.0430.0278.04
4.3.10.0370.0178.04
4.3.00.0430.0278.04

preferences:
54.18 ms | 401 KiB | 5 Q