3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "['text', 'te\\'\"x,2t', \"tex,t\", \"te\\\"x'#t\", true, True, [false, False, 100, +100], -100, + 10, - 20]"; $parts = preg_split('/\s*(\\\\["\']|"(?:\\\\"|[^"])*"|\'(?:\\\\\'|[^\'])*\')\s*|\s*([,\[\]])\s*/', $str, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); foreach ($parts as &$part) { if (preg_match("/^'(.*)'/", $part, $matches)) { $part = '"' . str_replace(array('"', "\\'"), array('\\"', "'"), $matches[1]) . '"'; continue; } $lpart = strtolower($part); if ($lpart == 'true' || $lpart == 'false') { $part = $lpart; continue; } if (preg_match('/^\+\s*(\d+)$/', $part, $matches)) { $part = $matches[1]; continue; } if (preg_match('/^-\s*(\d+)$/', $part, $matches)) { $part = '-' . $matches[1]; continue; } } $json = implode('', $parts); var_dump(json_decode($json));

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.0120.00817.86
8.4.130.0140.00717.64
8.4.120.0130.00720.90
8.4.110.0120.00918.75
8.4.100.0140.00318.08
8.4.90.0090.00518.49
8.4.80.0150.00618.20
8.4.70.0120.01018.01
8.4.60.0100.00818.87
8.4.50.0100.01020.87
8.4.40.0100.01019.72
8.4.30.0140.01020.80
8.4.20.0070.01020.72
8.4.10.0100.00617.87
8.3.270.0110.00916.66
8.3.260.0090.01016.92
8.3.250.0100.00717.45
8.3.240.0070.00516.74
8.3.230.0110.00816.79
8.3.220.0130.00717.30
8.3.210.0070.00216.93
8.3.200.0040.00516.49
8.3.190.0100.00517.16
8.3.180.0110.00916.81
8.3.170.0060.00917.24
8.3.160.0100.00016.94
8.3.150.0110.00420.90
8.3.140.0060.00316.82
8.3.130.0100.00017.04
8.3.120.0070.00319.07
8.3.110.0060.00317.04
8.3.100.0060.00318.75
8.3.90.0040.00416.66
8.3.80.0050.00517.97
8.3.70.0030.01617.00
8.3.60.0040.01416.86
8.3.50.0080.01417.50
8.3.40.0130.00318.93
8.3.30.0070.01018.89
8.3.20.0000.00820.77
8.3.10.0080.00022.15
8.3.00.0080.00022.58
8.2.290.0040.00520.79
8.2.280.0090.00719.15
8.2.270.0050.00317.43
8.2.260.0100.01019.23
8.2.250.0070.01117.08
8.2.240.0040.00417.26
8.2.230.0060.00620.94
8.2.220.0000.00924.06
8.2.210.0080.00826.77
8.2.200.0090.00018.54
8.2.190.0070.01116.75
8.2.180.0060.00918.43
8.2.170.0120.00922.96
8.2.160.0140.00322.25
8.2.150.0090.00024.18
8.2.140.0050.00324.66
8.2.130.0060.00326.16
8.2.120.0040.00419.89
8.2.110.0050.00521.12
8.2.100.0040.00817.97
8.2.90.0000.00818.14
8.2.80.0080.00018.03
8.2.70.0000.00818.05
8.2.60.0060.00318.14
8.2.50.0000.00918.10
8.2.40.0000.00819.39
8.2.30.0070.00019.41
8.2.20.0000.00818.32
8.2.10.0050.00319.36
8.2.00.0000.00719.47
8.1.330.0120.00716.50
8.1.320.0130.00616.39
8.1.310.0110.00716.96
8.1.300.0060.00316.97
8.1.290.0030.00618.88
8.1.280.0150.00025.92
8.1.270.0040.00421.00
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00322.02
8.1.230.0080.00422.71
8.1.220.0030.00517.88
8.1.210.0030.00620.16
8.1.200.0000.01217.72
8.1.190.0090.00017.50
8.1.180.0030.00618.10
8.1.170.0090.00018.77
8.1.160.0030.00619.05
8.1.150.0050.00219.05
8.1.140.0020.00520.96
8.1.130.0000.00720.11
8.1.120.0030.00517.57
8.1.110.0000.00817.62
8.1.100.0040.00417.64
8.1.90.0080.00017.64
8.1.80.0030.00517.49
8.1.70.0060.00317.59
8.1.60.0040.00417.60
8.1.50.0040.00417.59
8.1.40.0030.00517.61
8.1.30.0040.00417.85
8.1.20.0030.00617.79
8.1.10.0000.00917.67
8.1.00.0030.00617.75
8.0.300.0030.00521.93
8.0.290.0000.00717.00
8.0.280.0000.00718.42
8.0.270.0030.00518.75
8.0.260.0040.00420.15
8.0.250.0000.00717.10
8.0.240.0000.00717.15
8.0.230.0000.00717.15
8.0.220.0050.00217.07
8.0.210.0040.00416.93
8.0.200.0030.00316.97
8.0.190.0040.00417.03
8.0.180.0030.00517.05
8.0.170.0080.00017.16
8.0.160.0000.00717.05
8.0.150.0000.00717.01
8.0.140.0050.00316.89
8.0.130.0060.00013.49
8.0.120.0040.00417.08
8.0.110.0090.00017.15
8.0.100.0000.00817.17
8.0.90.0060.00317.09
8.0.80.0110.00917.07
8.0.70.0000.00717.08
8.0.60.0040.00417.00
8.0.50.0030.00517.16
8.0.30.0130.00417.48
8.0.20.0070.01117.42
8.0.10.0000.00717.25
8.0.00.0120.00717.06
7.4.330.0000.00516.87
7.4.320.0030.00316.86
7.4.300.0030.00316.88
7.4.290.0030.00316.80
7.4.280.0000.00816.71
7.4.270.0070.00016.80
7.4.260.0030.00313.57
7.4.250.0050.00316.65
7.4.240.0040.00416.80
7.4.230.0070.00016.73
7.4.220.0020.00616.87
7.4.210.0090.00616.92
7.4.200.0040.00416.99
7.4.130.0120.00616.92
7.4.120.0040.01616.96
7.4.110.0080.01516.83
7.4.100.0140.00316.68
7.4.90.0120.01216.90
7.4.80.0110.00719.39
7.4.70.0080.00816.92
7.4.60.0090.01016.84
7.4.50.0110.00416.73
7.4.40.0150.00316.75
7.4.00.0070.01015.27
7.3.330.0040.00416.43
7.3.320.0030.00313.40
7.3.310.0000.00716.60
7.3.300.0030.00316.52
7.3.290.0110.00516.47
7.3.260.0120.01016.60
7.3.240.0080.01316.56
7.3.230.0080.01716.57
7.3.210.0070.01016.55
7.3.200.0160.00616.76
7.3.190.0100.00716.44
7.3.180.0100.01416.65
7.3.170.0110.01116.45
7.3.160.0030.01416.62
7.3.90.0040.01415.17
7.3.80.0110.00515.31
7.3.70.0060.00915.06
7.3.60.0160.00014.98
7.3.50.0060.01214.85
7.3.40.0100.00714.95
7.3.30.0060.00914.70
7.3.20.0110.00814.95
7.3.10.0090.01214.93
7.3.00.0120.01014.85
7.2.330.0110.00816.73
7.2.320.0070.01016.94
7.2.310.0100.01016.91
7.2.300.0130.00516.79
7.2.290.0160.00316.99
7.2.220.0100.01115.10
7.2.210.0090.00615.04
7.2.200.0070.00715.13
7.2.190.0100.00615.18
7.2.180.0030.01615.19
7.2.170.0030.01515.18
7.2.160.0060.01115.31
7.2.150.0060.01415.34
7.2.140.0170.00715.18
7.2.130.0060.01515.31
7.2.120.0120.00615.12
7.2.110.0090.00915.29
7.2.100.0110.01115.27
7.2.90.0160.00615.00
7.2.80.0110.01115.29
7.2.70.0030.01414.99
7.2.60.0110.01115.26
7.2.50.0130.01015.28
7.2.40.0130.00715.31
7.2.30.0180.00315.43
7.2.20.0060.01615.39
7.2.10.0090.01415.25
7.2.00.0100.00715.27
7.1.320.0110.01114.24
7.1.310.0030.01214.27
7.1.300.0130.01014.32
7.1.290.0110.00713.89
7.1.280.0150.00614.13
7.1.270.0120.00814.11
7.1.260.0550.01014.08
7.1.250.0120.00613.93

preferences:
31.08 ms | 403 KiB | 5 Q