3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverseRecursive($array, $recursing = false) { foreach ($array as $key => $value) { if (is_array($value)) { $array[$key] = '(' . reverseRecursive($value, true) . ')'; } } $first = $recursing ? array_shift($array) . ',' : ''; return $first . implode(',', array_reverse($array)); } $data = '(X,1,1,3),(X,1,1,3),(X,@2,@2,@2,@2,@2,(Y,1))'; $json = preg_replace(['/[^(),]+/', '/\(/', '/\)/'], ['"$0"', '[', ']'], "($data)"); $inverse = reverseRecursive(json_decode($json)); echo $inverse;

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.0120.00720.45
8.4.150.0030.00014.05
8.4.140.0130.00817.96
8.4.130.0110.00617.94
8.4.120.0130.00820.41
8.4.110.0150.00622.53
8.4.100.0120.00918.66
8.4.90.0130.00620.63
8.4.80.0130.00618.98
8.4.70.0150.00619.07
8.4.60.0120.01019.03
8.4.50.0120.00718.17
8.4.40.0170.00317.80
8.4.30.0170.00318.71
8.4.20.0140.00621.86
8.4.10.0040.00419.69
8.3.280.0170.00418.64
8.3.270.0110.00916.86
8.3.260.0110.00616.67
8.3.250.0110.00819.02
8.3.240.0130.00616.68
8.3.230.0140.00616.61
8.3.220.0140.00718.75
8.3.210.0110.00816.76
8.3.200.0050.00516.78
8.3.190.0080.00717.06
8.3.180.0100.00916.66
8.3.170.0090.00919.11
8.3.160.0100.00716.86
8.3.150.0140.00416.99
8.3.140.0040.00418.80
8.3.130.0080.00018.66
8.3.120.0090.00620.68
8.3.110.0080.00820.94
8.3.100.0080.00016.79
8.3.90.0040.00426.77
8.3.80.0090.00018.56
8.3.70.0440.01017.97
8.3.60.0360.01217.97
8.3.50.0200.00317.97
8.3.40.0270.01017.97
8.3.30.0310.01017.97
8.3.20.0290.01217.97
8.3.10.0380.00417.97
8.3.00.0330.00317.97
8.2.290.0100.01020.51
8.2.280.0040.00420.46
8.2.270.0060.01217.06
8.2.260.0050.00318.64
8.2.250.0030.01216.86
8.2.240.0110.00417.13
8.2.230.0120.00822.58
8.2.220.0050.00524.06
8.2.210.0030.00626.77
8.2.200.0060.00318.66
8.2.190.0120.00317.97
8.2.180.0180.01517.97
8.2.170.0340.01217.97
8.2.160.0400.01017.97
8.2.150.0320.00017.97
8.2.140.0200.00417.97
8.2.130.0200.00317.97
8.2.120.0200.00617.97
8.2.110.0190.00517.97
8.2.100.0150.00717.97
8.2.90.0280.00017.97
8.2.80.0240.00517.97
8.2.70.0300.00817.97
8.2.60.0270.00817.97
8.2.50.0330.00317.97
8.2.40.0220.00417.97
8.2.30.0230.00417.97
8.2.20.0170.01417.97
8.2.10.0230.00817.97
8.2.00.0280.00717.97
8.1.330.0110.00821.98
8.1.320.0100.00916.62
8.1.310.0060.00316.80
8.1.300.0060.00317.98
8.1.290.0030.00630.84
8.1.280.0330.01417.97
8.1.270.0340.00817.97
8.1.260.0350.00317.97
8.1.250.0130.00917.97
8.1.240.0210.00317.97
8.1.230.0210.00317.97
8.1.220.0180.00617.97
8.1.210.0190.00917.97
8.1.200.0200.00317.97
8.1.190.0220.00017.97
8.1.180.0260.00017.97
8.1.170.0200.00017.97
8.1.160.0130.00717.97
8.1.150.0150.00517.97
8.1.140.0200.00617.97
8.1.130.0130.00917.97
8.1.120.0120.00817.97
8.1.110.0280.00717.97
8.1.100.0350.01017.97
8.1.90.0240.00417.97
8.1.80.0190.00417.97
8.1.70.0200.00017.97
8.1.60.0180.00417.97
8.1.50.0180.00417.97
8.1.40.0250.00417.97
8.1.30.0290.00617.97
8.1.20.0370.00417.97
8.1.10.0160.01017.97
8.1.00.0220.00017.97

preferences:
75.12 ms | 403 KiB | 5 Q