3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ "1" => [ "book" => "Harry Potter", "artist" => array("David", "Emma"), "country" => [ ["description" => "Wander"], ["description" => "Magic"] ] ], "2" => [ "book" => "Science book", "artist" => array("Artist 1", "Melanie Hudson"), "country" => [ ["description" => "Physics"], ["description" => "Albert Einstein"] ] ], "3" => [ "book" => "Bible", "artist" => array("Artist 1", "Pedro"), "country" => [ ["description" => "Love"], ["description" => "Respect"] ] ], ]; $result = []; // $result is container for matches - filled by reference $needle = 'Wander'; // the key we are looking for recurse($data, $needle, $result); function recurse($haystack = [], $needle = '', &$result) { foreach($haystack as $key => $value) { if(is_array($value)) { recurse($value, $needle, $result); } else { if(strpos($value, $needle) !== false) { $result[] = $value; // store match } } } } echo '<pre>'; var_dump($result); echo '</pre>';

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.5.00.0160.00520.17
8.4.150.0010.00114.05
8.4.140.0100.01017.56
8.4.130.0120.00817.82
8.4.120.0100.01120.65
8.4.110.0100.01018.75
8.4.100.0150.00617.98
8.4.90.0100.01020.49
8.4.80.0110.00718.78
8.4.70.0120.00718.92
8.4.60.0060.00420.65
8.4.50.0120.00918.13
8.4.40.0000.02017.68
8.4.30.0060.00320.52
8.4.20.0030.00817.93
8.4.10.0060.00322.31
8.3.280.0160.00618.61
8.3.270.0120.00816.89
8.3.260.0130.00716.67
8.3.250.0100.00819.04
8.3.240.0060.00317.34
8.3.230.0090.01016.75
8.3.220.0090.00718.86
8.3.210.0080.00716.57
8.3.200.0030.00616.54
8.3.190.0110.00716.84
8.3.180.0090.00818.72
8.3.170.0100.01016.43
8.3.160.0100.00719.13
8.3.150.0090.01217.38
8.3.140.0100.00718.93
8.3.130.0000.01018.55
8.3.120.0060.00320.72
8.3.110.0090.00620.94
8.3.100.0090.00018.64
8.3.90.0040.00416.82
8.3.80.0030.00616.75
8.3.70.0090.00618.60
8.3.60.0160.00618.43
8.3.50.0170.00324.58
8.3.40.0160.00018.68
8.3.30.0150.00018.85
8.3.20.0070.00024.18
8.3.10.0050.00224.66
8.3.00.0060.00326.16
8.2.290.0110.00917.10
8.2.280.0080.01018.53
8.2.270.0180.00016.68
8.2.260.0090.00016.79
8.2.250.0130.00618.34
8.2.240.0060.00318.84
8.2.230.0170.00322.58
8.2.220.0080.00837.54
8.2.210.0110.00826.77
8.2.200.0060.00316.50
8.2.190.0030.01416.58
8.2.180.0030.01425.92
8.2.170.0040.01118.94
8.2.160.0110.00322.96
8.2.150.0000.00725.66
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0040.00421.02
8.2.110.0030.00620.52
8.2.100.0090.00317.90
8.2.90.0090.00019.21
8.2.80.0080.00017.97
8.2.70.0000.01017.75
8.2.60.0000.00818.04
8.2.50.0040.00418.07
8.2.40.0050.00318.35
8.2.30.0040.00718.07
8.2.20.0000.00718.14
8.2.10.0040.00419.31
8.2.00.0000.00819.30
8.1.330.0060.01318.50
8.1.320.0100.00916.16
8.1.310.0130.00616.11
8.1.300.0060.00316.16
8.1.290.0030.00618.88
8.1.280.0170.00325.92
8.1.270.0070.00423.99
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0100.00019.13
8.1.230.0110.00020.86
8.1.220.0030.00617.74
8.1.210.0060.00318.77
8.1.200.0040.00417.00
8.1.190.0000.00817.23
8.1.180.0030.00618.10
8.1.170.0000.00818.65
8.1.160.0000.00718.89
8.1.150.0000.00718.80
8.1.140.0040.00418.89
8.1.130.0000.00720.20
8.1.120.0000.00717.39
8.1.110.0040.00417.52
8.1.100.0060.00317.35
8.1.90.0040.00417.34
8.1.80.0040.00717.46
8.1.70.0040.00417.48
8.1.60.0000.00817.57
8.1.50.0060.00617.58
8.1.40.0050.00317.59
8.1.30.0060.00317.59
8.1.20.0000.00817.53
8.1.10.0040.00717.52
8.1.00.0030.00517.42
8.0.300.0000.00718.77
8.0.290.0040.00416.63
8.0.280.0030.00318.34
8.0.270.0030.00318.01
8.0.260.0050.00318.45
8.0.250.0000.00617.02
8.0.240.0000.00716.92
8.0.230.0000.00716.93
8.0.220.0060.00316.84
8.0.210.0040.00416.93
8.0.200.0050.00317.08
8.0.190.0020.00516.91
8.0.180.0070.00016.96
8.0.170.0050.00516.96
8.0.160.0040.00416.94
8.0.150.0000.00716.95
8.0.140.0040.00416.81
8.0.130.0000.00513.39
8.0.120.0040.00416.93
8.0.110.0040.00416.82
8.0.100.0070.00016.80
8.0.90.0000.00717.07
8.0.80.0080.00716.96
8.0.70.0040.00416.98
8.0.60.0000.00816.98
8.0.50.0000.00717.05
8.0.30.0150.00617.00
8.0.20.0050.01517.07
8.0.10.0070.00016.91
8.0.00.0160.00317.02
7.4.330.0020.00215.55
7.4.320.0030.00316.53
7.4.300.0000.00616.50
7.4.290.0030.00516.59
7.4.280.0030.00716.60
7.4.270.0000.00716.66
7.4.260.0000.00513.19
7.4.250.0000.00716.61
7.4.240.0070.00016.51
7.4.230.0040.00416.51
7.4.220.0040.00316.58
7.4.210.0060.00916.62
7.4.200.0070.00016.26
7.4.130.0110.00716.45
7.4.120.0090.01516.47
7.4.110.0100.00616.57
7.4.100.0130.00416.35
7.4.90.0220.00016.59
7.4.80.0130.00619.39
7.4.70.0160.00316.40
7.4.60.0090.00916.45
7.4.50.0150.00616.40
7.4.40.0130.01016.37
7.4.30.0060.01316.45
7.4.20.0120.00616.29
7.4.10.0030.01416.55
7.4.00.0060.01116.45
7.3.330.0070.00016.34
7.3.320.0060.00013.27
7.3.310.0070.00016.39
7.3.300.0070.00016.33
7.3.290.0070.00916.33
7.3.280.0100.00316.26
7.3.260.0140.00316.60
7.3.240.0060.01116.55
7.3.230.0140.00316.41
7.3.210.0150.00416.59
7.3.200.0100.01316.32
7.3.190.0120.01216.31
7.3.180.0120.01116.33
7.3.170.0050.01816.54
7.3.160.0080.01516.33
7.3.150.0040.01216.50
7.3.140.0080.00816.34
7.3.130.0090.00916.25
7.3.120.0030.01316.27
7.3.110.0080.00816.41
7.3.100.0000.01916.34
7.3.90.0120.00916.63
7.3.80.0160.00516.46
7.3.70.0090.00916.45
7.3.60.0080.01416.31
7.3.50.0100.01016.54
7.3.40.0030.01416.43
7.3.30.0060.00916.29
7.3.20.0030.01416.40
7.3.10.0080.00916.18
7.3.00.0110.00716.29
7.2.330.0030.01616.80
7.2.320.0030.01516.78
7.2.310.0120.00816.74
7.2.300.0140.00716.62
7.2.290.0120.00616.51
7.2.280.0120.01516.45
7.2.270.0090.00916.70
7.2.260.0030.01316.84
7.2.250.0060.01216.78
7.2.240.0040.01116.57
7.2.230.0140.01316.46
7.2.220.0170.00416.75
7.2.210.0050.01416.79
7.2.200.0080.01116.50
7.2.190.0110.01216.62
7.2.180.0060.01016.63
7.2.170.0080.00816.57
7.2.160.0070.01016.62
7.2.150.0040.01316.66
7.2.140.0140.00316.65
7.2.130.0120.01216.76
7.2.120.0150.00916.73
7.2.110.0110.01116.88
7.2.100.0140.00616.54
7.2.90.0090.01416.61
7.2.80.0080.01016.68
7.2.70.0060.01516.80
7.2.60.0080.01316.74
7.2.50.0140.01116.78
7.2.40.0260.01316.73
7.2.30.0050.02016.67
7.2.20.0130.01016.38
7.2.10.0100.01316.69
7.2.00.0150.00816.72

preferences:
160.45 ms | 403 KiB | 5 Q