3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testArray = ['a' => ['b' => 'l'], 'c' => 'm', 'd' => ['n' => 'o']]; $actionArray = ['setType' => ['b' => 'int']]; function toUpperRecursive($arr, $actionArray) { foreach ($arr as $key => $val) { if (is_array($val)) { // $newKey = strtoupper($key); $arr[$key] = toUpperRecursive($val, $actionArray); // unset($arr[$key]); } elseif (is_string($val)) { echo $key . "\n"; echo $val . "\n"; foreach($actionArray as $actionType => $keyParamArray) { echo $actionType . "\n"; // echo $foo . "\n"; foreach ($keyParamArray as $actionKey => $actionParam) { if($key === $actionKey) { switch ($actionType) { case 'setType': echo $actionParam . "\n"; $arr[$key] = $val . ' + 1111'; break; } } } } } } return $arr; } // echo "before:\n"; // var_export($testArray); // echo "after:\n"; // var_export(toUpperRecursive($testArray)); var_export(toUpperRecursive($testArray, $actionArray));

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.0060.01218.31
8.3.50.0100.01018.15
8.3.40.0040.01118.84
8.3.30.0100.00618.63
8.3.20.0040.00421.91
8.3.10.0050.00321.77
8.3.00.0040.00419.79
8.2.180.0140.00718.52
8.2.170.0040.01122.96
8.2.160.0070.00721.19
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0070.00019.30
8.2.120.0050.00326.35
8.2.110.0090.00920.99
8.2.100.0090.00317.99
8.2.90.0060.00317.84
8.2.80.0040.00418.22
8.2.70.0000.00817.91
8.2.60.0000.00917.93
8.2.50.0090.00018.22
8.2.40.0050.00220.53
8.2.30.0040.00419.23
8.2.20.0060.00618.09
8.2.10.0000.00718.16
8.2.00.0000.00818.16
8.1.280.0070.00725.92
8.1.270.0040.00423.71
8.1.260.0050.00326.35
8.1.250.0100.00028.09
8.1.240.0130.00022.04
8.1.230.0110.00020.97
8.1.220.0000.00817.78
8.1.210.0030.00618.77
8.1.200.0050.00317.48
8.1.190.0080.00017.22
8.1.180.0030.00618.10
8.1.170.0000.00818.54
8.1.160.0040.00418.93
8.1.150.0000.00719.06
8.1.140.0070.00017.70
8.1.130.0000.00718.99
8.1.120.0020.00517.57
8.1.110.0000.00717.38
8.1.100.0000.00917.48
8.1.90.0070.00417.50
8.1.80.0040.00417.46
8.1.70.0040.00417.52
8.1.60.0040.00417.59
8.1.50.0060.00317.63
8.1.40.0000.00817.59
8.1.30.0000.00917.61
8.1.20.0000.00817.73
8.1.10.0040.00417.57
8.1.00.0070.00017.44
8.0.300.0080.00019.96
8.0.290.0080.00016.63
8.0.280.0030.00318.47
8.0.270.0080.00017.41
8.0.260.0030.00317.35
8.0.250.0070.00016.89
8.0.240.0000.00816.92
8.0.230.0100.00016.91
8.0.220.0040.00416.83
8.0.210.0030.00316.81
8.0.200.0000.00916.88
8.0.190.0000.00716.99
8.0.180.0070.00016.88
8.0.170.0000.00816.96
8.0.160.0070.00016.88
8.0.150.0000.00716.76
8.0.140.0040.00416.78
8.0.130.0060.00013.32
8.0.120.0000.00816.79
8.0.110.0080.00016.84
8.0.100.0070.00016.75
8.0.90.0070.00016.95
8.0.80.0150.00016.91
8.0.70.0030.00516.98
8.0.60.0030.00516.83
8.0.50.0000.00816.90
8.0.30.0130.00417.13
8.0.20.0120.00717.40
8.0.10.0040.00417.07
8.0.00.0100.01016.78
7.4.330.0000.00516.66
7.4.320.0000.00616.57
7.4.300.0070.00016.55
7.4.290.0030.00316.53
7.4.280.0060.00316.43
7.4.270.0000.00916.65
7.4.260.0070.00016.48
7.4.250.0000.00716.60
7.4.240.0030.00316.70
7.4.230.0040.00416.52
7.4.220.0000.00716.48
7.4.210.0030.01016.60
7.4.200.0030.00316.67
7.4.160.0090.00716.58
7.4.140.0070.01117.86
7.4.130.0110.00816.52
7.4.120.0090.00916.62
7.4.110.0110.01116.65
7.4.100.0100.00716.52
7.4.90.0120.00616.54
7.4.80.0120.00619.39
7.4.70.0100.00716.46
7.4.60.0120.00616.42
7.4.50.0030.01416.41
7.4.40.0120.00916.58
7.4.00.0000.01714.93
7.3.330.0000.00513.46
7.3.320.0030.00313.23
7.3.310.0000.00716.21
7.3.300.0050.00316.44
7.3.290.0070.00016.45
7.3.280.0060.00916.40
7.3.260.0110.00716.58
7.3.240.0100.00816.59
7.3.230.0130.00916.63
7.3.210.0120.00916.29
7.3.200.0060.01016.64
7.3.190.0060.01016.46
7.3.180.0060.01016.37
7.3.170.0100.00716.34
7.3.160.0100.00716.59
7.2.330.0140.00416.75
7.2.320.0130.00916.69
7.2.310.0160.00616.81
7.2.300.0160.00016.77
7.2.290.0050.01416.45
7.2.110.0040.01116.58
7.2.60.0130.01116.95
7.2.40.6210.01218.11
7.2.30.5960.01017.97
7.2.20.4600.01317.96
7.2.10.4120.01317.83
7.2.00.4380.01418.04
7.1.200.0040.01115.84
7.1.160.5020.01217.04
7.1.150.5440.01716.75
7.1.140.5210.01316.95
7.1.130.3290.00917.00
7.1.120.5130.01416.88
7.1.110.3990.00916.42
7.1.100.2580.01216.40
7.1.90.0140.01116.32
7.1.80.0130.01316.02
7.1.70.0090.01515.36
7.1.60.0370.02733.39
7.1.50.0480.01632.86
7.1.40.0480.01632.62
7.1.30.0300.01432.78
7.1.20.0310.01432.78
7.1.10.0090.00814.77
7.1.00.0140.01214.84

preferences:
58.8 ms | 401 KiB | 5 Q