3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ '1' => true, ['2' => false, '4' => true], '3' => true ]; function findKeysWithTrueValues(array $array): array { $matches = []; foreach ($array as $key => $value) { if (is_array($value)) { foreach (findKeysWithTrueValues($value) as $match) { $matches[] = $match; } } elseif ($value === true) { $matches[] = $key; } } return $matches; } print_r(findKeysWithTrueValues($array));

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.4.130.0060.00318.71
8.4.120.0130.00723.95
8.4.110.0120.00818.82
8.4.100.0050.00417.62
8.4.90.0130.00818.59
8.4.80.0100.01017.77
8.4.70.0110.00917.71
8.4.60.0110.00918.54
8.4.50.0170.00619.57
8.4.40.0080.00017.84
8.4.30.0170.00320.25
8.4.20.0170.00319.52
8.4.10.0030.01317.51
8.3.260.0130.00716.49
8.3.250.0120.00719.17
8.3.240.0100.00916.75
8.3.230.0100.00716.73
8.3.220.0120.00617.02
8.3.210.0080.00616.77
8.3.200.0060.00216.46
8.3.190.0100.01016.66
8.3.180.0070.01216.54
8.3.170.0180.00016.74
8.3.160.0140.00416.63
8.3.150.0100.01017.13
8.3.140.0040.01618.92
8.3.130.0060.00316.50
8.3.120.0110.00718.91
8.3.110.0060.00320.94
8.3.100.0040.00424.06
8.3.90.0070.00426.77
8.3.80.0050.00518.30
8.3.70.0080.00816.58
8.3.60.0120.00918.43
8.3.50.0100.00824.46
8.3.40.0170.00320.46
8.3.30.0140.00018.67
8.3.20.0050.00220.84
8.3.10.0040.00420.39
8.3.00.0000.01422.21
8.2.290.0130.00620.34
8.2.280.0100.00820.21
8.2.270.0150.00316.54
8.2.260.0040.00416.67
8.2.250.0000.00817.42
8.2.240.0070.01018.96
8.2.230.0050.00522.58
8.2.220.0060.01037.54
8.2.210.0070.01126.77
8.2.200.0060.00616.38
8.2.190.0070.00716.58
8.2.180.0100.01016.75
8.2.170.0090.00622.96
8.2.160.0070.00721.05
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0070.00726.16
8.2.120.0090.00018.72
8.2.110.0080.00020.58
8.2.100.0080.00417.59
8.2.90.0030.00517.88
8.2.80.0040.00418.86
8.2.70.0030.00617.80
8.2.60.0040.00418.16
8.2.50.0060.00318.10
8.2.40.0040.00419.30
8.2.30.0040.00419.18
8.2.20.0040.00418.12
8.2.10.0040.00419.31
8.2.00.0040.00419.41
8.1.330.0160.00421.99
8.1.320.0110.00816.06
8.1.310.0000.00816.87
8.1.300.0080.00020.13
8.1.290.0060.00318.88
8.1.280.0150.00025.92
8.1.270.0040.00422.46
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0180.00023.86
8.1.230.0080.00421.95
8.1.220.0080.00017.74
8.1.210.0080.00018.77
8.1.200.0100.00017.22
8.1.190.0040.00417.23
8.1.180.0000.00718.95
8.1.170.0040.00418.46
8.1.160.0000.00819.02
8.1.150.0040.00418.89
8.1.140.0070.00018.93
8.1.130.0030.00320.13
8.1.120.0000.00717.38
8.1.110.0030.00517.47
8.1.100.0040.00417.48
8.1.90.0070.00017.50
8.1.80.0000.00817.47
8.1.70.0070.00017.46
8.1.60.0040.00417.57
8.1.50.0040.00417.52
8.1.40.0000.00817.44
8.1.30.0050.00317.57
8.1.20.0080.00017.66
8.1.10.0000.00817.57
8.1.00.0030.00617.42
8.0.300.0040.00418.77
8.0.290.0000.00816.58
8.0.280.0070.00018.50
8.0.270.0030.00316.80
8.0.260.0000.00620.09
8.0.250.0030.00316.91
8.0.240.0030.00316.99
8.0.230.0000.00716.84
8.0.220.0000.00716.89
8.0.210.0030.00316.91
8.0.200.0000.00717.01
8.0.190.0080.00016.83
8.0.180.0030.00616.84
8.0.170.0000.00816.92
8.0.160.0070.00016.81
8.0.150.0030.00516.83
8.0.140.0000.00716.83
8.0.130.0000.00513.32
8.0.120.0020.00516.89
8.0.110.0000.00716.76
8.0.100.0020.00516.85
8.0.90.0000.00916.77
8.0.80.0080.01216.85
8.0.70.0000.00716.71
8.0.60.0000.00716.93
8.0.50.0050.00316.89
8.0.30.0130.00317.06
8.0.20.0130.00517.07
8.0.10.0040.00417.08
8.0.00.0140.01016.61
7.4.330.0030.00315.55
7.4.320.0000.00616.42
7.4.300.0060.00016.57
7.4.290.0030.00316.36
7.4.280.0030.00516.43
7.4.270.0070.00316.59
7.4.260.0050.00013.27
7.4.250.0030.00316.53
7.4.240.0070.00016.48
7.4.230.0000.00716.31
7.4.220.0020.00416.59
7.4.210.0070.00716.52
7.4.200.0070.00016.61
7.4.130.0050.01216.54
7.4.120.0060.01316.48
7.4.110.0110.00716.41
7.4.100.0100.00716.70
7.4.90.0130.01016.51
7.4.80.0120.00619.39
7.4.70.0080.00816.41
7.4.60.0100.00616.25
7.4.50.0110.00316.33
7.4.40.0170.00316.43
7.4.30.0100.00716.69
7.4.20.0050.01516.47
7.4.10.0130.00516.43
7.4.00.0130.00616.57
7.3.330.0030.00316.41
7.3.320.0000.00613.21
7.3.310.0040.00416.28
7.3.300.0030.00316.33
7.3.290.0090.00716.37
7.3.260.0110.00616.73
7.3.240.0070.01216.48
7.3.230.0110.00616.59
7.3.210.0130.00316.41
7.3.200.0120.00416.40
7.3.190.0070.01516.36
7.3.180.0140.00716.74
7.3.170.0140.00316.55
7.3.160.0170.00316.67
7.3.150.0140.00716.65
7.3.140.0160.00616.50
7.3.130.0090.00916.41
7.3.120.0080.01516.62
7.3.110.0140.00716.39
7.3.100.0110.01216.64
7.3.90.0090.01416.41
7.3.80.0030.02016.53
7.3.70.0120.01216.41
7.3.60.0170.01016.46
7.3.50.0090.00916.32
7.3.40.0040.01116.41
7.3.30.0040.01116.49
7.3.20.0090.00616.42
7.3.10.0060.01316.44
7.3.00.0060.00916.53
7.2.330.0100.01016.61
7.2.320.0070.01116.70
7.2.310.0160.00616.42
7.2.300.0000.01816.69
7.2.290.0030.01416.67
7.2.280.0150.00816.59
7.2.270.0110.00916.84
7.2.260.0120.00816.70
7.2.250.0100.01616.42
7.2.240.0090.01416.65
7.2.230.0120.01616.40
7.2.220.0130.01316.52
7.2.210.0060.01516.68
7.2.200.0130.01316.64
7.2.190.0070.01416.57
7.2.180.0070.01316.56
7.2.170.0060.00916.58
7.2.160.0090.00616.59
7.2.150.0030.01316.66
7.2.140.0080.00816.55
7.2.130.0090.01216.65
7.2.120.0070.01016.62
7.2.110.0070.01016.59
7.2.100.0070.01116.55
7.2.90.0070.01716.58
7.2.80.0110.00616.59
7.2.70.0060.01216.49
7.2.60.0060.01116.54
7.2.50.0070.01116.80
7.2.40.0100.00716.59
7.2.30.0070.01016.70
7.2.20.0100.00716.52
7.2.10.0030.01416.67
7.2.00.0110.00716.55

preferences:
122.57 ms | 403 KiB | 5 Q