3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @throws JsonException */ function alterJson(string $json): string { $data = json_decode($json, false, 512, JSON_THROW_ON_ERROR); if (empty($data->expire_user_id)) { return '{}'; } $data->expire_user_id = explode(',', $data->expire_user_id); $data->user_id = array_shift($data->expire_user_id); if ($data->expire_user_id) { $data->expire_user_id = implode(',', $data->expire_user_id); } else { unset($data->expire_user_id); } return json_encode($data, JSON_THROW_ON_ERROR); } echo alterJson(<<<JSON {"user_id":3,"created_at":"2020-10-05 04:59:05","expire_user_id":"2,1"} JSON), PHP_EOL; echo alterJson(<<<JSON {"user_id":3,"created_at":"2020-10-05 04:59:05","expire_user_id":"1"} JSON), PHP_EOL; echo alterJson(<<<JSON {"user_id":3,"created_at":"2020-10-05 04:59:05"} JSON), PHP_EOL;

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.5.10.0090.00816.86
8.5.00.0120.01119.86
8.4.160.0120.01019.77
8.4.150.0020.00114.05
8.4.140.0110.01117.61
8.4.130.0060.00419.25
8.4.120.0100.00722.31
8.4.110.0130.00717.89
8.4.100.0110.01017.93
8.4.90.0040.00520.65
8.4.80.0110.00818.88
8.4.70.0070.01017.95
8.4.60.0110.00518.94
8.4.50.0110.01019.02
8.4.40.0170.00319.61
8.4.30.0080.01218.57
8.4.20.0160.00319.74
8.4.10.0050.00320.55
8.3.280.0120.01018.37
8.3.270.0160.00716.32
8.3.260.0130.00716.31
8.3.250.0100.00617.10
8.3.240.0130.00716.55
8.3.230.0090.00916.86
8.3.220.0150.00318.82
8.3.210.0150.00416.50
8.3.200.0030.00616.76
8.3.190.0100.00716.54
8.3.180.0100.00816.42
8.3.170.0070.01118.67
8.3.160.0060.00618.32
8.3.150.0000.02016.90
8.3.140.0070.00318.91
8.3.130.0150.00018.24
8.3.120.0090.00616.82
8.3.110.0030.00616.75
8.3.100.0060.00318.30
8.3.90.0090.00616.53
8.3.80.0040.00419.36
8.3.70.0100.00618.50
8.3.60.0090.00618.48
8.3.50.0090.01023.66
8.3.40.0070.01021.86
8.3.30.0040.01118.80
8.3.20.0040.00424.18
8.3.10.0000.00724.66
8.3.00.0040.00426.16
8.2.290.0100.00816.70
8.2.280.0110.00818.52
8.2.270.0060.00317.36
8.2.260.0090.00016.50
8.2.250.0120.00316.73
8.2.240.0040.00716.75
8.2.230.0120.00920.94
8.2.220.0090.00024.06
8.2.210.0180.00026.77
8.2.200.0030.00618.88
8.2.190.0000.01816.75
8.2.180.0090.00625.92
8.2.170.0040.01119.08
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0050.00326.35
8.2.110.0060.00320.46
8.2.100.0050.00517.91
8.2.90.0000.00817.75
8.2.80.0050.00318.73
8.2.70.0090.00017.63
8.2.60.0090.00417.78
8.2.50.0120.00417.72
8.2.40.0000.01217.79
8.2.30.0100.00417.86
8.2.20.0070.00517.72
8.2.10.0070.00518.25
8.2.00.0110.00018.23
8.1.330.0130.00716.23
8.1.320.0100.01018.36
8.1.310.0050.00318.54
8.1.300.0120.00417.91
8.1.290.0090.00030.84
8.1.280.0150.00025.92
8.1.270.0040.00723.73
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0080.00318.57
8.1.230.0110.00017.83
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0060.00317.22
8.1.190.0080.00517.12
8.1.180.0110.00117.61
8.1.170.0090.00317.83
8.1.160.0080.00518.07
8.1.150.0040.01017.91
8.1.140.0060.00617.85
8.1.130.0100.00118.17
8.1.120.0060.00617.36
8.1.110.0130.00017.35
8.1.100.0050.00817.42
8.1.90.0080.00417.18
8.1.80.0070.00517.22
8.1.70.0070.00517.35
8.1.60.0080.00617.44
8.1.50.0110.00117.33
8.1.40.0070.00517.46
8.1.30.0070.00617.50
8.1.20.0080.00617.52
8.1.10.0010.01017.47
8.1.00.0070.00417.37
8.0.300.0040.00418.77
8.0.290.0030.00516.75
8.0.280.0130.00017.53
8.0.270.0120.00017.36
8.0.260.0050.00716.82
8.0.250.0060.00516.84
8.0.240.0040.00816.90
8.0.230.0090.00316.72
8.0.220.0070.00516.78
8.0.210.0090.00316.73
8.0.200.0100.00216.74
8.0.190.0090.00416.70
8.0.180.0060.00516.86
8.0.170.0040.00816.74
8.0.160.0070.00516.82
8.0.150.0100.00116.83
8.0.140.0070.00416.78
8.0.130.0060.00515.53
8.0.120.0070.00516.80
8.0.110.0080.00416.72
8.0.100.0080.00716.74
8.0.90.0100.00416.75
8.0.80.0120.00716.82
8.0.70.0080.00716.75
8.0.60.0080.00616.74
8.0.50.0120.00316.75
8.0.30.0120.00616.81
8.0.20.0130.00616.99
8.0.10.0110.00316.99
8.0.00.0120.00416.79
7.4.330.0040.00516.03
7.4.320.0060.00616.48
7.4.300.0060.00516.55
7.4.290.0050.00616.53
7.4.280.0070.00616.59
7.4.270.0010.00916.54
7.4.260.0140.00215.45
7.4.250.0110.00416.60
7.4.240.0110.00316.56
7.4.230.0120.00216.60
7.4.220.0070.00516.56
7.4.210.0110.00716.59
7.4.200.0070.00616.53
7.4.190.0080.00616.60
7.4.180.0070.00616.59
7.4.160.0100.00516.56
7.4.150.0110.00216.53
7.4.140.0080.00616.50
7.4.130.0100.00616.49
7.4.120.0120.00816.51
7.4.110.0100.01016.56
7.4.100.0110.00716.38
7.4.90.0140.00316.35
7.4.80.0160.00716.31
7.4.70.0150.00316.27
7.4.60.0110.00616.40
7.4.50.0140.00416.37
7.4.40.0140.00516.40
7.4.30.0130.00716.34
7.4.20.0160.00416.32
7.4.10.0160.00316.38
7.4.00.0120.00716.38
7.3.330.0090.00516.36
7.3.320.0090.00515.45
7.3.310.0090.00516.37
7.3.300.0090.00416.34
7.3.290.0100.00616.44
7.3.280.0150.00216.47
7.3.270.0140.00216.36
7.3.260.0160.01016.47
7.3.250.0130.00416.40
7.3.240.0170.00016.38
7.3.230.0180.00116.26
7.3.220.0120.00716.35
7.3.210.0130.00516.38
7.3.200.0120.00816.34
7.3.190.0110.00616.35
7.3.180.0100.00816.34
7.3.170.0090.01016.33
7.3.160.0150.00816.36
7.3.150.0120.00716.47
7.3.140.0180.00616.39
7.3.130.0170.00616.51
7.3.120.0210.00916.42
7.3.110.0170.00616.34
7.3.100.0160.00716.44
7.3.90.0150.00516.53
7.3.80.0150.00516.49
7.3.70.0110.00816.40
7.3.60.0100.00716.44
7.3.50.0110.00716.55
7.3.40.0110.00616.38
7.3.30.0130.00516.40
7.3.20.0150.00617.06
7.3.10.0110.00817.09
7.3.00.0110.01017.03
7.2.340.0170.00716.38
7.2.330.0120.00716.14
7.2.320.0170.00316.27
7.2.310.0110.00916.09
7.2.300.0120.00716.29
7.2.290.0120.00716.32
7.2.280.0140.00916.31
7.2.270.0150.00316.17
7.2.260.0180.00616.34
7.2.250.0170.00616.38
7.2.240.0170.00616.34
7.2.230.0110.00916.29
7.2.220.0120.00816.34
7.2.210.0100.00816.31
7.2.200.0130.00516.43
7.2.190.0130.00716.29
7.2.180.0080.01016.36
7.2.170.0120.00716.36
7.2.160.0140.00516.40
7.2.150.0260.00717.01
7.2.140.0090.00816.98
7.2.130.0120.00617.04
7.2.120.0110.00717.04
7.2.110.0080.00917.06
7.2.100.0160.00217.05
7.2.90.0150.00316.99
7.2.80.0110.00717.00
7.2.70.0130.00617.02
7.2.60.0120.00617.11
7.2.50.0130.00517.03
7.2.40.0130.00617.07
7.2.30.0120.00617.03
7.2.20.0180.00616.97
7.2.10.0140.00417.08
7.2.00.0140.00417.16

preferences:
127.28 ms | 403 KiB | 5 Q