3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'Name/First' => 'John', 'Name/Last' => 'Doe', 'Age' => 20, 'Address/Postal/City' => 'New York', 'Address/Postal/Zip' => 10003, 'Address/Billing/City' => 'Los Angeles', 'Phone' => 123456789, 'Foo/Bar' => 'test1', 'Foo/Bar/Foo2/Bar2' => 'test2', ]; $newarray = []; foreach($array as $path => $value) { $keys = array_filter(explode('/', $path)); $ref = &$newarray; foreach($keys as $level => $key) { if (!array_key_exists($key, $ref)) $ref[$key] = []; $ref = &$ref[$key]; if (isset($ref) && !is_array($ref)) { break; } } if (is_array($ref)) { $ref = $value; } } print_r($newarray);

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.0110.01017.87
8.4.130.0080.00617.76
8.4.120.0140.00724.02
8.4.110.0110.00918.99
8.4.100.0140.00717.68
8.4.90.0140.00617.55
8.4.80.0050.00320.80
8.4.70.0100.00917.47
8.4.60.0170.00418.80
8.4.50.0090.01219.43
8.4.40.0100.00017.89
8.4.30.0210.00320.59
8.4.20.0040.01517.69
8.4.10.0100.01019.38
8.3.270.0100.01016.61
8.3.260.0110.00916.54
8.3.250.0120.00818.98
8.3.240.0130.00717.21
8.3.230.0080.01116.75
8.3.220.0150.00417.18
8.3.210.0100.00616.73
8.3.200.0050.00416.61
8.3.190.0120.00617.13
8.3.180.0070.00916.66
8.3.170.0190.00016.80
8.3.160.0130.00316.72
8.3.150.0140.00420.74
8.3.140.0040.01116.29
8.3.130.0080.00016.80
8.3.120.0070.01118.93
8.3.110.0070.00720.94
8.3.100.0100.01024.06
8.3.90.0150.00426.77
8.3.80.0030.00716.50
8.3.70.0040.01116.75
8.3.60.0190.00318.43
8.3.50.0130.00319.96
8.3.40.0140.00718.88
8.3.30.0110.00618.66
8.3.20.0060.00324.18
8.3.10.0070.01124.66
8.3.00.0000.00826.16
8.2.290.0120.00718.96
8.2.280.0100.01218.42
8.2.270.0110.00717.03
8.2.260.0150.00018.52
8.2.250.0060.00318.30
8.2.240.0040.00418.74
8.2.230.0040.00422.58
8.2.220.0090.00037.54
8.2.210.0120.00626.77
8.2.200.0060.00316.75
8.2.190.0140.00716.63
8.2.180.0100.01025.92
8.2.170.0100.01019.04
8.2.160.0040.01122.96
8.2.150.0040.00425.66
8.2.140.0070.01024.66
8.2.130.0040.00426.16
8.2.120.0000.00820.92
8.2.110.0040.00720.47
8.2.100.0030.00622.20
8.1.330.0070.00519.83
8.1.320.0120.00716.21
8.1.310.0150.00316.76
8.1.300.0150.00416.07
8.1.290.0040.00718.88
8.1.280.0170.00325.92
8.1.270.0000.00723.99
8.1.260.0110.00826.35
8.1.250.0050.00328.09
8.1.240.0070.00418.94
8.1.230.0030.00618.38
7.4.260.0040.00416.55

preferences:
28.48 ms | 403 KiB | 5 Q