3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string='[ { "id": "7ac648ce-18aa-11e9-b673-005056be36b2", "answer": "1", "id_question": "39", "pi": "very good", "ca": null, "pic": null, "new_deadline": null, "reason": null, "notes": null, "deadline": null }, { "id": "8653ef3d-18aa-11e9-b673-005056be36b2", "answer": "3", "id_question": "40", "pi": "no problem", "ca": null, "pic": null, "new_deadline": null, "reason": null, "notes": null, "deadline": null } ]'; $string2='[ { "id": "38", "question": "Kebersihan Meja Counter dan Meja Fincoy ", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "39", "question": "Seragam Sales Counter / Salesman* ", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "40", "question": "Kerapihan Sales Counter", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "42", "question": "Sales Guide", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "43", "question": "Product Card", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "44", "question": "Ketersediaan Buku Tamu", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "45", "question": "Ketersediaan Price List", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "46", "question": "Ketersedian Rak Brosur ", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "47", "question": "Ketersediaan Flyer*/brosur\t", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" } ]'; $json = json_decode($string, true); $json2 = json_decode($string2, true); $array0=array(); foreach($json as $key) { $array0[$key['id_question']]=$key; } $array1=array(); foreach($json2 as $key) { $array1[$key['id']]=$key['question']; if(!isset($array0[$key['id']])) { $row=array(); $row["id"]=$key['question']; $row["id_question"]=$key['id']; $row["answer"]=null; $row["pi"]=null; $row["ca"]=null; $row["pic"]=null; $row["new_deadline"]=null; $row["reason"]=null; $row["notes"]=null; $row["deadline"]=null; $array0[]=$row; } } $array2=array(); foreach($array0 as $key) { if(isset($array1[trim($key['id_question'])])){ $key['question']=$array1[$key['id_question']]; } $key['id']=$key['id_question']; unset($key['id_question']); $array2[]=$key; } // echo // print_r($array2); // convert to json $json=json_encode($array2); print_r($json); die;

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.0130.00817.93
8.4.130.0120.00818.04
8.4.120.0080.00820.84
8.4.110.0130.00720.60
8.4.100.0120.00717.57
8.4.90.0140.00818.63
8.4.80.0120.00518.10
8.4.70.0080.00717.96
8.4.60.0030.00619.14
8.4.50.0070.00318.16
8.4.40.0040.00717.68
8.4.30.0030.00619.49
8.4.20.0040.00420.70
8.4.10.0090.00017.70
8.3.270.0100.01116.71
8.3.260.0120.00816.91
8.3.250.0140.00619.04
8.3.240.0100.00916.54
8.3.230.0140.00516.79
8.3.220.0110.00817.20
8.3.210.0080.00616.68
8.3.200.0060.00316.67
8.3.190.0090.00917.12
8.3.180.0100.00417.14
8.3.170.0090.00918.73
8.3.160.0070.01117.20
8.3.150.0150.00317.06
8.3.140.0090.00016.76
8.3.130.0030.01718.29
8.3.120.0060.00320.88
8.3.110.0100.01020.94
8.3.100.0040.00724.06
8.3.90.0060.00926.77
8.3.80.0110.00016.63
8.3.70.0070.01416.75
8.3.60.0110.00418.43
8.3.50.0100.00719.05
8.3.40.0120.00319.05
8.3.30.0060.00918.82
8.3.20.0040.00421.60
8.3.10.0040.00423.65
8.3.00.0080.00023.66
8.2.290.0140.00520.27
8.2.280.0120.00618.50
8.2.270.0120.00617.27
8.2.260.0120.00618.22
8.2.250.0100.01016.63
8.2.240.0050.00518.90
8.2.230.0090.00622.58
8.2.220.0090.00037.54
8.2.210.0070.01026.77
8.2.200.0030.00616.88
8.2.190.0000.01616.88
8.2.180.0160.00618.41
8.2.170.0110.00422.96
8.2.160.0070.00720.43
8.2.150.0050.00324.18
8.2.140.0070.00324.66
8.2.130.0040.00426.16
8.2.120.0030.00619.89
8.2.110.0060.00322.21
8.2.100.0090.00317.91
8.2.90.0090.00022.32
8.2.80.0030.00718.04
8.2.70.0000.00917.93
8.2.60.0000.00818.22
8.2.50.0040.00418.10
8.2.40.0030.00619.30
8.2.30.0000.00719.39
8.2.20.0050.00218.14
8.2.10.0070.00019.40
8.2.00.0080.00018.20
8.1.330.0120.00622.07
8.1.320.0090.01116.48
8.1.310.0040.00418.22
8.1.300.0060.00920.29
8.1.290.0060.00318.88
8.1.280.0070.00725.92
8.1.270.0060.00318.87
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0070.00322.60
8.1.230.0090.00320.85
8.1.220.0040.00417.78
8.1.210.0030.00518.92
8.1.200.0080.00017.35
8.1.190.0000.00817.35
8.1.180.0100.00218.10
8.1.170.0030.00618.64
8.1.160.0070.00319.02
8.1.150.0040.00418.91
8.1.140.0030.00518.91
8.1.130.0070.00017.46
8.1.120.0030.00317.41
8.1.110.0000.00817.47
8.1.100.0050.00317.41
8.1.90.0030.00617.50
8.1.80.0040.00417.48
8.1.70.0000.00717.48
8.1.60.0040.00417.63
8.1.50.0000.00917.59
8.1.40.0030.00617.57
8.1.30.0040.00417.67
8.1.20.0000.00817.67
8.1.10.0060.00317.59
8.1.00.0000.00817.50
8.0.300.0060.00319.90
8.0.290.0040.00416.75
8.0.280.0070.00418.46
8.0.270.0000.00717.28
8.0.260.0050.00216.99
8.0.250.0070.00017.00
8.0.240.0040.00417.11
8.0.230.0040.00416.93
8.0.220.0030.00317.04
8.0.210.0000.00717.01
8.0.200.0000.00717.05
8.0.190.0000.00717.02
8.0.180.0080.00016.89
8.0.170.0040.00416.90
8.0.160.0030.00516.97
8.0.150.0040.00416.87
8.0.140.0000.00716.99
8.0.130.0000.00613.37
8.0.120.0070.00016.94
8.0.110.0040.00416.97
8.0.100.0050.00216.92
8.0.90.0000.00817.02
8.0.80.0030.01717.01
8.0.70.0030.00616.87
8.0.60.0040.00416.88
8.0.50.0000.00716.87
8.0.30.0130.00517.32
8.0.20.0110.00917.40
8.0.10.0080.00017.07
8.0.00.0100.00916.76
7.4.330.0000.00515.55
7.4.320.0060.00016.63
7.4.300.0030.00316.53
7.4.290.0050.00516.63
7.4.280.0040.00416.51
7.4.270.0000.00716.66
7.4.260.0000.00816.51
7.4.250.0000.00716.48
7.4.240.0000.00716.55
7.4.230.0020.00516.72
7.4.220.0050.00316.55
7.4.210.0060.01016.48
7.4.200.0000.00716.66
7.4.160.0080.00716.53
7.4.140.0100.01017.86
7.4.130.0120.00616.43
7.4.120.0110.01516.42
7.4.110.0110.00716.47
7.4.100.0090.00916.72
7.4.90.0060.01216.60
7.4.80.0060.01619.39
7.4.70.0080.01116.42
7.4.60.0090.01216.38
7.4.50.0090.00916.23
7.4.40.0070.01316.43
7.4.10.0030.01615.00
7.4.00.0050.01115.12
7.3.330.0000.00513.30
7.3.320.0000.00613.25
7.3.310.0030.00516.27
7.3.300.0070.00016.40
7.3.290.0070.00016.40
7.3.280.0130.00316.40
7.3.260.0100.00816.50
7.3.240.0130.00816.50
7.3.230.0060.01216.45
7.3.210.0120.00416.37
7.3.200.0110.01116.70
7.3.190.0030.01716.46
7.3.180.0100.00716.60
7.3.170.0130.00616.41
7.3.160.0110.00516.47
7.3.130.0040.01114.87
7.3.120.0050.01214.95
7.3.110.0070.01114.76
7.3.100.0050.01014.89
7.3.90.0050.01114.82
7.3.80.0020.01214.88
7.3.70.0050.00914.75
7.3.60.0040.00914.79
7.3.50.0050.00914.89
7.3.40.0050.01114.94
7.3.30.0120.00214.96
7.3.20.0050.01016.67
7.3.10.0490.00615.33
7.3.00.0450.00615.34
7.2.330.0120.00616.76
7.2.320.0100.00816.59
7.2.310.0030.01316.75
7.2.300.0170.00716.79
7.2.290.0070.01016.58
7.2.260.0140.00715.02
7.2.250.0070.01015.20
7.2.240.0090.00714.96
7.2.230.0090.00915.22
7.2.220.0110.00515.13
7.2.210.0000.01715.21
7.2.200.0070.00815.20
7.2.190.0050.01015.00
7.2.180.0080.00714.93
7.2.170.0070.01015.16
7.2.160.0090.00315.08
7.2.150.0030.00716.84
7.2.140.0030.00716.86
7.2.130.0540.00815.28
7.2.120.0650.00815.35
7.2.110.0640.00715.34
7.2.100.0590.00615.44
7.2.90.0490.00815.47
7.2.80.0450.00915.34
7.2.70.0540.00915.42
7.2.60.0470.00615.42
7.2.50.0460.00615.30
7.2.40.0450.00615.36
7.2.30.0610.00615.36
7.2.20.0830.00615.40
7.2.10.0470.00515.39
7.2.00.0470.00615.46
7.1.330.0050.01016.01
7.1.320.0030.00815.94
7.1.310.0030.01515.62
7.1.300.0030.00915.63
7.1.290.0050.00815.86
7.1.280.0080.00615.85
7.1.270.0090.00615.76
7.1.260.0050.00515.92
7.1.250.0510.00514.29
7.1.240.0070.01015.86
7.1.230.0070.01115.97
7.1.220.0060.00615.89
7.1.210.0130.00015.82
7.1.200.0060.01215.61
7.1.190.0030.01015.81
7.1.180.0000.01515.82
7.1.170.0060.00615.92
7.1.160.0030.00615.99
7.1.150.0040.00815.85
7.1.140.0090.00615.71
7.1.130.0060.00615.83
7.1.120.0040.01115.71
7.1.110.0030.01015.91
7.1.100.0080.00415.84
7.1.90.0120.00315.57
7.1.80.0110.00415.63
7.1.70.0030.01315.98
7.1.60.0110.00015.88
7.1.50.0000.00815.74
7.1.40.0060.00615.72
7.1.30.0110.00415.61
7.1.20.0060.00915.91
7.1.10.0100.00315.77
7.1.00.0040.00715.74

preferences:
35.46 ms | 406 KiB | 6 Q