3v4l.org

run code in 300+ PHP versions simultaneously
<?php // stackoverflow.com/questions/20348380 function fixJSON($json) { $regex = <<<'REGEX' ~ "[^"\\]*(?:\\.|[^"\\]*)*" (*SKIP)(*F) | '([^'\\]*(?:\\.|[^'\\]*)*)' ~x REGEX; return preg_replace_callback($regex, function($matches) { return '"' . preg_replace('~\\\\.(*SKIP)(*F)|"~', '\\"', $matches[1]) . '"'; }, $json); } $json = "{'id': '3', 'answer': '1'},{'id': '4', 'answer': 'здесь ответ на вопрос, 12345 abc'},{'id': '4', 'answer': '123'}"; $obj = json_decode(fixJSON("[$json]")); foreach ($obj as $key=>$val) { echo "$val->answer\n"; }

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.0070.01118.55
8.3.50.0130.01018.28
8.3.40.0000.01418.92
8.3.30.0120.00318.96
8.3.20.0070.00024.18
8.3.10.0050.00324.66
8.3.00.0040.00426.16
8.2.180.0080.00825.92
8.2.170.0100.01019.19
8.2.160.0100.01022.96
8.2.150.0000.00825.66
8.2.140.0080.00024.66
8.2.130.0030.00626.16
8.2.120.0040.00421.18
8.2.110.0090.00322.38
8.2.100.0000.01118.09
8.2.90.0000.00817.75
8.2.80.0040.00418.91
8.2.70.0000.00917.88
8.2.60.0030.00617.75
8.2.50.0050.00518.10
8.2.40.0040.00419.64
8.2.30.0000.00719.48
8.2.20.0070.00018.13
8.2.10.0000.00819.42
8.2.00.0040.00419.23
8.1.280.0070.00725.92
8.1.270.0050.00523.99
8.1.260.0080.00026.35
8.1.250.0030.00528.09
8.1.240.0060.00322.51
8.1.230.0130.00017.85
8.1.220.0000.00817.74
8.1.210.0060.00318.77
8.1.200.0080.00017.47
8.1.190.0060.00317.35
8.1.180.0000.00818.10
8.1.170.0000.00818.77
8.1.160.0070.00319.06
8.1.150.0030.00518.98
8.1.140.0040.00418.81
8.1.130.0000.00720.19
8.1.120.0030.00617.67
8.1.110.0030.00517.63
8.1.100.0050.00217.59
8.1.90.0040.00417.59
8.1.80.0040.00417.72
8.1.70.0000.00717.61
8.1.60.0040.00417.63
8.1.50.0060.00617.59
8.1.40.0080.00017.63
8.1.30.0080.00417.82
8.1.20.0040.00417.70
8.1.10.0000.00817.65
8.1.00.0000.00817.62
8.0.300.0040.00418.77
8.0.290.0050.00317.00
8.0.280.0030.00418.40
8.0.270.0060.00317.12
8.0.260.0070.00018.41
8.0.250.0000.00717.06
8.0.240.0000.00717.18
8.0.230.0070.00017.21
8.0.220.0070.00417.02
8.0.210.0000.00817.17
8.0.200.0000.00717.18
8.0.190.0030.00617.18
8.0.180.0040.00417.17
8.0.170.0000.00917.20
8.0.160.0000.00717.02
8.0.150.0070.00017.14
8.0.140.0000.00717.06
8.0.130.0030.00313.58
8.0.120.0040.00417.13
8.0.110.0000.00716.99
8.0.100.0000.00817.01
8.0.90.0070.00017.08
8.0.80.0130.00617.12
8.0.70.0040.00417.24
8.0.60.0000.00717.08
8.0.50.0040.00417.20
8.0.30.0070.01017.30
8.0.20.0080.01017.30
8.0.10.0000.00717.32
8.0.00.0140.00516.79
7.4.330.0040.00015.55
7.4.320.0030.00316.65
7.4.300.0070.00416.74
7.4.290.0000.00816.80
7.4.280.0050.00216.65
7.4.270.0000.01116.73
7.4.260.0030.00313.51
7.4.250.0070.00016.70
7.4.240.0040.00416.81
7.4.230.0070.00016.59
7.4.220.0050.00216.74
7.4.210.0110.00716.84
7.4.200.0000.00716.84
7.4.130.0070.01216.68
7.4.120.0180.00016.92
7.4.110.0070.01016.84
7.4.100.0100.00716.62
7.4.90.0120.00616.71
7.4.80.0130.00316.77
7.4.70.0100.00616.74
7.4.60.0060.01016.64
7.4.50.0110.00416.66
7.4.40.0070.01016.52
7.4.30.0120.00416.78
7.4.20.0130.00716.71
7.4.10.0080.00916.68
7.4.00.0130.00316.74
7.3.330.0040.00416.63
7.3.320.0030.00313.59
7.3.310.0030.00316.64
7.3.300.0000.00716.60
7.3.290.0060.00916.60
7.3.260.0160.00316.65
7.3.230.0140.00716.76
7.3.210.0090.00916.63
7.3.200.0030.01316.89
7.3.190.0060.00916.68
7.3.180.0060.00916.64
7.3.170.0130.00316.61
7.3.160.0090.00616.61
7.3.150.0120.00616.66
7.3.140.0060.01016.91
7.3.130.0110.00616.61
7.3.120.0060.00916.56
7.3.110.0100.00716.80
7.3.100.0040.01116.73
7.3.90.0030.01316.55
7.3.80.0100.00716.75
7.3.70.0200.00016.66
7.3.60.0060.01016.64
7.3.50.0090.00916.70
7.3.40.0140.00316.73
7.3.30.0040.01316.70
7.3.20.0150.00616.42
7.3.10.0150.00616.61
7.3.00.0200.00316.76
7.2.330.0000.01816.87
7.2.320.0110.00717.08
7.2.310.0060.00916.72
7.2.300.0100.00716.77
7.2.290.0070.01016.68
7.2.280.0060.01216.87
7.2.270.0060.01317.01
7.2.260.0060.01116.95
7.2.250.0070.01017.09
7.2.240.0030.01316.84
7.2.230.0140.00316.75
7.2.220.0000.01716.78
7.2.210.0100.00716.95
7.2.200.0090.00916.96
7.2.190.0090.00916.93
7.2.180.0030.01516.95
7.2.170.0080.00816.96
7.2.160.0060.00916.68
7.2.150.0110.01116.92
7.2.140.0090.01216.69
7.2.130.0090.01016.79
7.2.120.0110.00716.89
7.2.110.0080.01216.77
7.2.100.0140.01016.84
7.2.90.0130.00716.86
7.2.80.0130.00716.73
7.2.70.0070.01116.78
7.2.60.0180.01116.89
7.2.50.0070.01016.93
7.2.40.0160.00316.89
7.2.30.0110.00717.05
7.2.20.0130.00816.82
7.2.10.0200.00316.86
7.2.00.0120.01216.88

preferences:
72.82 ms | 401 KiB | 5 Q