3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'vehicle info' => [ 'one' => [ 'submodel' => 'LX', 'engine' => 2.3 ], 'two' => [ 'color' => 'blue', 'year' => 2007, 'wheels' => 4 ], 'three' => [ 'submodel' => 'LX', 'make' => 'Ford', 'model' => 'F-150', 'offroad' => 'No' ] ] ]; $soughtKeys = array_flip(['submodel', 'offroad']); function earlyReturningRecursion(array $array, array $soughtKeys, array &$result = []): array { foreach ($array as $key => $value) { if (!array_diff_key($soughtKeys, $result)) { return $result; } elseif (is_array($value)) { earlyReturningRecursion($value, $soughtKeys, $result); } elseif (isset($soughtKeys[$key]) && !key_exists($key, $result)) { $result[$key] = "$key is $value"; } } return $result; } var_export(earlyReturningRecursion($array, $soughtKeys));

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.140.0100.01017.64
8.4.130.0100.01017.55
8.4.120.0120.00820.44
8.4.110.0120.00822.39
8.4.100.0150.00618.02
8.4.90.0140.00718.64
8.4.80.0050.00318.67
8.4.70.0040.00417.99
8.4.60.0080.01518.46
8.4.50.0120.00820.53
8.4.40.0170.00317.73
8.4.30.0200.00020.63
8.4.20.0200.00017.61
8.4.10.0100.00722.21
8.3.270.0100.00916.61
8.3.260.0100.01016.57
8.3.250.0120.00718.94
8.3.240.0110.00817.20
8.3.230.0120.00716.59
8.3.220.0050.00519.11
8.3.210.0090.01018.43
8.3.200.0060.00416.64
8.3.190.0080.00717.10
8.3.180.0110.00818.95
8.3.170.0150.00318.70
8.3.160.0060.00317.13
8.3.150.0070.01117.18
8.3.140.0110.00716.50
8.3.130.0080.00016.53
8.3.120.0110.00019.01
8.3.110.0060.00318.55
8.3.100.0090.00016.62
8.3.90.0040.00418.42
8.3.80.0000.00917.97
8.3.70.0100.00718.30
8.3.60.0140.00716.47
8.3.50.0070.00716.76
8.3.40.0110.00321.61
8.3.30.0100.01018.91
8.3.20.0080.00024.18
8.3.10.0080.00024.66
8.3.00.0120.00727.44
8.2.290.0040.00420.42
8.2.280.0130.00618.40
8.2.270.0060.01219.08
8.2.260.0140.00416.58
8.2.250.0000.00818.24
8.2.240.0060.00317.42
8.2.230.0030.00720.94
8.2.220.0090.00024.06
8.2.210.0040.00426.77
8.2.200.0000.00918.16
8.2.190.0120.00316.58
8.2.180.0150.00316.88
8.2.170.0210.00019.02
8.2.160.0030.01022.96
8.2.150.0050.00325.66
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00422.25
8.2.110.0060.00322.10
8.2.100.0120.00017.65
8.2.90.0000.01217.75
8.2.80.0300.00017.38
8.2.70.0190.01117.38
8.2.60.0210.01017.25
8.2.50.0300.00017.25
8.2.40.0250.00417.46
8.2.30.0150.01217.63
8.2.20.0100.00317.63
8.2.10.0250.00417.25
8.2.00.0210.00717.63
8.1.330.0100.00821.94
8.1.320.0140.00515.98
8.1.310.0180.00016.47
8.1.300.0140.00718.39
8.1.290.0030.00630.84
8.1.280.0050.00925.92
8.1.270.0040.00424.66
8.1.260.0060.00626.35
8.1.250.0050.00328.09
8.1.240.0060.00322.42
8.1.230.0000.01124.03
8.1.220.0200.00817.13
8.1.210.0290.00417.00
8.1.200.0310.00016.86
8.1.190.0230.00616.80
8.1.180.0260.00617.00
8.1.170.0240.00717.00
8.1.160.0270.00316.80
8.1.150.0180.01416.80
8.1.140.0200.01117.11
8.1.130.0260.00716.88
8.1.120.0290.00317.35
8.1.110.0180.00917.34
8.1.100.0250.00617.25
8.1.90.0230.00417.13
8.1.80.0230.00517.13
8.1.70.0240.00417.18
8.1.60.0360.00417.25
8.1.50.0270.00017.13
8.1.40.0200.00717.50
8.1.30.0160.00817.42
8.1.20.0200.00717.50
8.1.10.0240.00317.25
8.1.00.0200.00617.25
8.0.300.0190.00816.80
8.0.290.0290.00016.80
8.0.280.0220.00616.80
8.0.270.0140.01416.80
8.0.260.0150.01216.80
8.0.250.0230.00416.80
8.0.240.0130.01316.80
8.0.230.0200.00816.80
8.0.220.0230.00616.80
8.0.210.0250.00316.80
8.0.200.0230.00316.80
8.0.190.0250.00416.80
8.0.180.0240.00416.80
8.0.170.0240.00416.80
8.0.160.0260.00516.80
8.0.150.0160.01216.80
8.0.140.0250.00716.80
8.0.130.0290.01416.80
8.0.120.0250.00316.80
8.0.110.0220.00316.80
8.0.100.0240.00316.80
8.0.90.0240.00416.80
8.0.80.0170.01217.96
8.0.70.0240.00716.80
8.0.60.0360.00316.80
8.0.50.0250.00016.80
8.0.30.0200.00716.80
8.0.20.0210.00716.80
8.0.10.0200.00816.80

preferences:
54.87 ms | 403 KiB | 5 Q