3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '[ ["key1", "value1"], ["key2", "value2"], ["key3", "value3"] ]'; preg_match_all('/(\[("(.*?)"), ("(.*?)")\])+/i', $str, $matches); //Now we have in $matches[3] and $matches[5] the keys and the values //and we would now turn this into an array using a loop $new_array = array(); foreach($matches[3] as $k => $arr) { $new_array[$arr] = $matches[5][$k]; } var_dump($new_array);

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.0190.00316.63
8.3.50.0160.00821.26
8.3.40.0140.00418.76
8.3.30.0090.00618.84
8.3.20.0030.00518.88
8.3.10.0080.00021.64
8.3.00.0050.00320.73
8.2.180.0100.01016.63
8.2.170.0100.01022.96
8.2.160.0070.00719.19
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0050.00321.26
8.2.120.0080.00026.35
8.2.110.0070.00319.11
8.2.100.0060.00617.75
8.2.90.0040.00419.30
8.2.80.0030.00617.97
8.2.70.0060.00617.88
8.2.60.0090.00017.93
8.2.50.0030.00618.10
8.2.40.0050.00322.27
8.2.30.0040.00420.75
8.2.20.0020.00517.79
8.2.10.0040.00418.14
8.2.00.0000.00718.26
8.1.280.0100.01025.92
8.1.270.0080.00023.97
8.1.260.0030.00628.09
8.1.250.0000.00728.09
8.1.240.0040.00422.74
8.1.230.0080.00417.83
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0000.00917.63
8.1.190.0000.00817.47
8.1.180.0070.00018.10
8.1.170.0000.00818.83
8.1.160.0000.00719.04
8.1.150.0000.00718.97
8.1.140.0050.00219.66
8.1.130.0070.00017.73
8.1.120.0000.00717.46
8.1.110.0030.00517.63
8.1.100.0050.00317.50
8.1.90.0030.00517.63
8.1.80.0050.00217.59
8.1.70.0000.00717.59
8.1.60.0030.00517.63
8.1.50.0030.00617.66
8.1.40.0040.00417.68
8.1.30.0040.00417.88
8.1.20.0030.00517.82
8.1.10.0000.00817.57
8.1.00.0040.00417.71
8.0.300.0000.00718.77
8.0.290.0000.00716.75
8.0.280.0030.00318.33
8.0.270.0070.00017.25
8.0.260.0050.00317.30
8.0.250.0060.00017.11
8.0.240.0000.00617.01
8.0.230.0040.00417.13
8.0.220.0050.00317.07
8.0.210.0000.00717.02
8.0.200.0040.00417.12
8.0.190.0000.00817.12
8.0.180.0040.00417.09
8.0.170.0040.00417.12
8.0.160.0040.00316.94
8.0.150.0000.00717.01
8.0.140.0000.00716.88
8.0.130.0050.00013.49
8.0.120.0050.00216.92
8.0.110.0000.00916.94
8.0.100.0000.00716.85
8.0.90.0040.00417.00
8.0.80.0100.00716.93
8.0.70.0020.00516.95
8.0.60.0040.00417.05
8.0.50.0040.00416.83
8.0.30.0140.00817.28
8.0.20.0060.01317.40
8.0.10.0050.00217.01
8.0.00.0100.00916.89
7.4.330.0000.00615.08
7.4.320.0030.00316.62
7.4.300.0040.00416.78
7.4.290.0070.00016.64
7.4.280.0070.00016.62
7.4.270.0030.00316.68
7.4.260.0030.00616.76
7.4.250.0030.00516.79
7.4.240.0030.00316.80
7.4.230.0040.00416.84
7.4.220.0060.01516.63
7.4.210.0110.00316.79
7.4.200.0030.00316.71
7.4.160.0150.00616.50
7.4.150.0070.01017.40
7.4.140.0160.00717.86
7.4.130.0120.00616.73
7.4.120.0090.00716.76
7.4.110.0140.00416.75
7.4.100.0090.01216.60
7.4.90.0070.01016.70
7.4.80.0040.01519.39
7.4.70.0110.00616.83
7.4.60.0090.00616.59
7.4.50.0120.00016.67
7.4.40.0080.00816.81
7.4.30.0130.00316.61
7.4.10.0000.02015.12
7.4.00.0080.00815.11
7.3.330.0000.00513.39
7.3.320.0000.00613.24
7.3.310.0000.00716.34
7.3.300.0030.00316.33
7.3.290.0090.00916.47
7.3.280.0050.00916.46
7.3.270.0080.01017.40
7.3.260.0070.01116.51
7.3.250.0090.01016.72
7.3.240.0110.00616.55
7.3.230.0060.01116.56
7.3.210.0150.00316.50
7.3.200.0110.00616.95
7.3.190.0110.00616.38
7.3.180.0100.00616.79
7.3.170.0110.00716.69
7.3.160.0100.01316.48
7.3.130.0070.01115.02
7.3.120.0110.00615.06
7.3.110.0120.00614.99
7.3.100.0050.00815.02
7.3.90.0050.01115.21
7.3.80.0030.01214.93
7.3.70.0000.01314.94
7.3.60.0050.01115.08
7.3.50.0070.00715.05
7.3.40.0060.00714.93
7.3.30.0050.00814.84
7.3.20.0050.00916.66
7.3.10.0050.00816.71
7.3.00.0050.00816.92
7.2.330.0060.01216.78
7.2.320.0130.01016.89
7.2.310.0130.00316.86
7.2.300.0050.01116.80
7.2.290.0100.00716.84
7.2.260.0070.01115.38
7.2.250.0050.01015.37
7.2.240.0100.00815.05
7.2.230.0060.00615.25
7.2.220.0080.00815.21
7.2.210.0100.00715.36
7.2.200.0020.01415.22
7.2.190.0050.01215.29
7.2.180.0040.01115.21
7.2.170.0070.00715.25
7.2.160.0070.00715.34
7.2.150.0040.01216.98
7.2.140.0030.00917.20
7.2.130.0060.01216.85
7.2.120.0070.00717.16
7.2.110.0060.00917.13
7.2.100.0060.00317.12
7.2.90.0090.00917.14
7.2.80.0000.01317.27
7.2.70.0000.01217.04
7.2.60.0030.00917.03
7.2.50.0030.01016.94
7.2.40.0040.00817.22
7.2.30.0040.01117.26
7.2.20.0050.00517.12
7.2.10.0130.00317.06
7.2.00.0050.00818.26
7.1.330.0050.00915.88
7.1.320.0050.00915.96
7.1.310.0080.00315.96
7.1.300.0090.00615.99
7.1.290.0060.00515.95
7.1.280.0070.00615.90
7.1.270.0020.01115.90
7.1.260.0080.00316.07
7.1.250.0060.00916.02
7.1.240.0110.00316.13
7.1.230.0040.01116.09
7.1.220.0080.00316.05
7.1.210.0030.00915.75
7.1.200.0060.00516.02
7.1.190.0040.00415.95
7.1.180.0100.00615.96
7.1.170.0060.00615.91
7.1.160.0070.00316.04
7.1.150.0070.00315.80
7.1.140.0040.00416.11
7.1.130.0000.01016.04
7.1.120.0090.00616.00
7.1.110.0060.00616.18
7.1.100.0050.01017.03
7.1.90.0070.00716.22
7.1.80.0130.00016.11
7.1.70.0030.01216.61
7.1.60.0050.00616.58
7.1.50.0040.01116.07
7.1.40.0000.01516.08
7.1.30.0000.00916.09
7.1.20.0030.01315.97
7.1.10.0120.00615.89
7.1.00.0040.04219.27
7.0.330.0030.00615.55
7.0.320.0030.00615.59
7.0.310.0070.00715.41
7.0.300.0030.01015.44
7.0.290.0050.00515.41
7.0.280.0060.00615.72
7.0.270.0000.01215.60
7.0.260.0070.00715.41
7.0.250.0060.00915.46
7.0.240.0030.00615.32
7.0.230.0030.00615.67
7.0.220.0090.00615.68
7.0.210.0040.01515.59
7.0.200.0020.01116.34
7.0.190.0070.00715.37
7.0.180.0040.01115.16
7.0.170.0040.01215.86
7.0.160.0030.01015.63
7.0.150.0070.00715.73
7.0.140.0000.01315.60
7.0.130.0030.01015.45
7.0.120.0000.01515.63
7.0.110.0030.01015.74
7.0.100.0030.01015.59
7.0.90.0040.00415.48
7.0.80.0070.00715.63
7.0.70.0140.00015.38
7.0.60.0150.04017.89
7.0.50.0100.02016.74
7.0.40.0150.03116.87
7.0.30.0080.04117.05
7.0.20.0380.02816.94
7.0.10.0300.03616.96
7.0.00.0050.03316.84
5.6.400.0100.00314.64
5.6.390.0060.00614.50
5.6.380.0060.00914.64
5.6.370.0040.01114.09
5.6.360.0000.00914.74
5.6.350.0060.00614.66
5.6.340.0040.01114.70
5.6.330.0080.00414.52
5.6.320.0040.01114.70
5.6.310.0030.01014.37
5.6.300.0120.00614.74
5.6.290.0030.01014.71
5.6.280.0040.04217.51
5.6.270.0100.00314.18
5.6.260.0000.01314.19
5.6.250.0000.01014.17
5.6.240.0000.00914.48
5.6.230.0090.00614.28
5.6.220.0080.00014.46
5.6.210.0080.04517.47
5.6.200.0030.04516.33
5.6.190.0110.03617.57
5.6.180.0020.03817.59
5.6.170.0310.03017.48
5.6.160.0100.03317.45
5.6.150.0140.03217.34
5.6.140.0450.02217.38
5.6.130.0320.03517.48
5.6.120.0130.02817.40
5.6.110.0220.03417.38
5.6.100.0310.03317.52
5.6.90.0240.03217.59
5.6.80.0290.02717.07
5.6.70.0100.02917.05
5.6.60.0120.03217.00
5.6.50.0110.02817.02
5.6.40.0100.04217.03
5.6.30.0080.04217.00
5.6.20.0130.03317.00
5.6.10.0050.03417.15
5.6.00.0080.03517.08
5.5.380.0030.01014.64
5.5.370.0000.01514.54
5.5.360.0000.00814.46
5.5.350.0030.02417.48
5.5.340.0090.03916.13
5.5.330.0250.03217.36
5.5.320.0070.03017.44
5.5.310.0280.03117.37
5.5.300.0180.04217.14
5.5.290.0310.03017.38
5.5.280.0050.03417.26
5.5.270.0320.03217.31
5.5.260.0250.03717.18
5.5.250.0230.03317.12
5.5.240.0400.02816.85
5.5.230.0150.03416.87
5.5.220.0280.03217.07
5.5.210.0150.02816.97
5.5.200.0100.03216.84
5.5.190.0080.03716.98
5.5.180.0190.04116.97
5.5.170.0060.00614.50
5.5.160.0070.03217.06
5.5.150.0060.03816.84
5.5.140.0100.03716.74
5.5.130.0140.03416.90
5.5.120.0060.03416.95
5.5.110.0130.03216.84
5.5.100.0150.02716.81
5.5.90.0090.03216.75
5.5.80.0160.02917.03
5.5.70.0130.02716.84
5.5.60.0120.02816.71
5.5.50.0180.02316.93
5.5.40.0100.02716.96
5.5.30.0070.03416.90
5.5.20.0050.04016.79
5.5.10.0120.03316.90
5.5.00.0180.02516.81

preferences:
37.41 ms | 401 KiB | 5 Q