3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = Array ( 0 => 'Accessories/Apron', 1 => 'Accessories/Banners', 2 => 'Accessories/Belts', 3 => 'Brand/Brand1', 4 => 'Brand/Brand2', 5 => 'Apparel/Men/Belts', 6 => 'Apparel/Men/Socks', 7 => 'Apparel/Women/Leggings' ); $result =[]; foreach($arr as $val){ $count = count(explode("/", $val)); $str = '{"' . str_replace('/', '":{"', $val) . '"}' . str_repeat("}", $count-1); $json = preg_replace("/(.*)(\{)(.*?)(\})/", "$1[$3]", $str); $result = array_merge_recursive($result, json_decode($json, true)); } Print_r($result);

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.10.0090.00619.73
8.3.140.0060.00316.91
8.3.130.0040.00418.30
8.3.120.0030.00619.00
8.3.110.0030.00616.73
8.3.100.0060.00324.06
8.3.90.0000.00826.77
8.3.80.0060.00319.36
8.3.70.0110.00716.63
8.3.60.0110.00716.61
8.3.50.0120.00523.67
8.3.40.0120.00319.05
8.3.30.0130.01018.84
8.3.20.0080.00024.18
8.3.10.0030.00624.66
8.3.00.0080.00026.16
8.2.260.0040.00416.68
8.2.250.0080.00016.92
8.2.240.0000.01019.10
8.2.230.0030.00720.94
8.2.220.0080.00037.54
8.2.210.0110.00726.77
8.2.200.0030.00618.88
8.2.190.0040.01416.75
8.2.180.0120.00625.92
8.2.170.0060.00918.79
8.2.160.0100.00322.96
8.2.150.0080.00025.66
8.2.140.0030.00524.66
8.2.130.0000.00826.16
8.2.120.0080.00019.66
8.2.110.0140.00722.39
8.2.100.0090.00317.91
8.2.90.0040.00417.88
8.2.80.0030.00619.08
8.2.70.0040.00418.04
8.2.60.0040.00418.09
8.2.50.0040.00418.10
8.2.40.0040.00819.36
8.2.30.0040.00419.28
8.2.20.0040.00418.21
8.2.10.0000.00719.49
8.2.00.0040.00419.48
8.1.310.0030.00616.85
8.1.300.0060.00320.07
8.1.290.0060.00330.84
8.1.280.0090.00625.92
8.1.270.0060.00323.79
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0090.00021.12
8.1.230.0070.00417.70
8.1.220.0040.00417.78
8.1.210.0030.00618.77
8.1.200.0060.00317.47
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0080.00018.59
8.1.160.0040.00418.94
8.1.150.0080.00018.94
8.1.140.0070.00018.94
8.1.130.0030.00320.20
8.1.120.0070.00317.59
8.1.110.0060.00317.59
8.1.100.0050.00317.63
8.1.90.0040.00417.62
8.1.80.0030.00517.65
8.1.70.0030.00317.63
8.1.60.0000.00917.74
8.1.50.0040.00417.63
8.1.40.0000.00917.68
8.1.30.0000.00917.88
8.1.20.0060.00317.80
8.1.10.0040.00417.66
8.1.00.0000.00817.68
8.0.300.0040.00418.77
8.0.290.0000.00916.75
8.0.280.0040.00418.41
8.0.270.0040.00416.96
8.0.260.0000.00818.50
8.0.250.0040.00417.01
8.0.240.0070.00317.04
8.0.230.0040.00417.17
8.0.220.0030.00317.01
8.0.210.0000.00717.11
8.0.200.0060.00317.09
8.0.190.0040.00417.17
8.0.180.0080.00016.99
8.0.170.0030.00617.14
8.0.160.0030.00517.17
8.0.150.0000.00716.97
8.0.140.0070.00017.09
8.0.130.0000.00613.49
8.0.120.0000.00817.03
8.0.110.0040.00417.02
8.0.100.0040.00416.86
8.0.90.0030.00617.03
8.0.80.0120.00517.04
8.0.70.0030.00517.08
8.0.60.0040.00416.89
8.0.50.0000.00717.10
8.0.30.0090.00917.16
8.0.20.0080.01417.19
8.0.10.0000.00717.30
8.0.00.0090.00916.95
7.4.330.0020.00215.55
7.4.320.0000.00616.79
7.4.300.0030.00316.88
7.4.290.0030.00516.75
7.4.280.0060.00316.73
7.4.270.0000.00716.85
7.4.260.0070.00016.81
7.4.250.0070.00016.82
7.4.240.0040.00416.65
7.4.230.0040.00416.77
7.4.220.0030.00416.83
7.4.210.0060.00916.76
7.4.200.0070.00016.62
7.4.130.0120.00716.84
7.4.120.0070.01716.57
7.4.110.0140.00316.46
7.4.100.0060.01216.84
7.4.90.0110.00716.61
7.4.80.0120.00619.39
7.4.70.0060.01216.48
7.4.60.0080.00816.76
7.4.50.0060.01216.69
7.4.40.0140.00716.43
7.4.30.0170.00316.65
7.4.20.0030.01416.53
7.4.10.0130.00716.51
7.4.00.0100.01016.63
7.3.330.0070.00016.60
7.3.320.0060.00013.19
7.3.310.0030.00316.40
7.3.300.0030.00316.48
7.3.290.0030.00316.23
7.3.280.0070.00716.38
7.3.260.0130.01116.59
7.3.240.0110.00716.65
7.3.230.0150.00316.39
7.3.210.0070.01016.47
7.3.200.0110.00616.42
7.3.190.0110.00616.79
7.3.180.0140.00716.57
7.3.170.0080.00816.83
7.3.160.0090.01216.60
7.3.150.0150.00616.75
7.3.140.0130.00916.70
7.3.130.0100.01016.77
7.3.120.0130.01116.73
7.3.110.0150.00616.41
7.3.100.0070.01016.69
7.3.90.0090.00916.46
7.3.80.0080.01216.38
7.3.70.0060.01316.64
7.3.60.0110.00716.55
7.3.50.0110.00516.35
7.3.40.0140.00716.55
7.3.30.0030.01416.58
7.3.20.0200.02018.38
7.3.10.0120.00618.25
7.3.00.0150.00618.32
7.2.330.0160.01216.90
7.2.320.0140.00316.96
7.2.310.0070.01416.83
7.2.300.0030.01416.95
7.2.290.0110.01116.76
7.2.280.0060.01616.74
7.2.270.0110.01116.68
7.2.260.0070.01416.71
7.2.250.0130.01016.79
7.2.240.0140.00716.91
7.2.230.0070.01316.71
7.2.220.0070.01116.82
7.2.210.0110.00716.87
7.2.200.0140.00316.74
7.2.190.0100.00716.73
7.2.180.0080.01516.72
7.2.170.0000.01816.73
7.2.160.0080.00816.88
7.2.150.0120.00618.67
7.2.140.0120.00618.59
7.2.130.0070.01118.55
7.2.120.0060.01218.76
7.2.110.0120.00918.62
7.2.100.0030.01418.53
7.2.90.0070.01118.59
7.2.80.0140.00418.66
7.2.70.0060.01318.67
7.2.60.0130.01018.69
7.2.50.0090.00918.59
7.2.40.0130.00618.66
7.2.30.0140.00318.80
7.2.20.0100.01318.65
7.2.10.0100.01318.68
7.2.00.0100.01318.61

preferences:
30.41 ms | 403 KiB | 5 Q