3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array_question = '[ { "id": "8", "question": "Shop sign/billboard " }, { "id": "10", "question": "Pylon" }, { "id": "11", "question": "Banner" }, { "id": "12", "question": "Sport" }, { "id": "14", "question": "Matic " }, { "id": "16", "question": "Cub" } ]'; $array_answer = '[ { "id": "1b9fa84e-0f2f-11e9-b673-005056be36b2", "answer": "3", "id_question": "16" }, { "id": "bc82c3fd-0f2e-11e9-b673-005056be36b2", "answer": "1", "id_question": "11" }, { "id": "cc9363f1-0f2e-11e9-b673-005056be36b2", "answer": "3", "id_question": "12" }, { "id": "f1dfa8b5-0f2e-11e9-b673-005056be36b2", "answer": "1", "id_question": "14" } ]'; $questions = json_decode($array_question); $answers = json_decode($array_answer, true); $array_result = array_map(function ($v) use ($answers) { $v->answer = ($k = array_search($v->id, array_column($answers, 'id_question'))) !== false ? $answers[$k]['answer'] : null; return $v; }, $questions); print_r(json_encode($array_result, JSON_UNESCAPED_SLASHES));

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.70.0000.01518.43
8.3.60.0190.00018.39
8.3.50.0070.00718.13
8.3.40.0070.00718.88
8.3.30.0080.00818.58
8.3.20.0040.00421.80
8.3.10.0040.00421.90
8.3.00.0000.00720.74
8.2.180.0060.01316.75
8.2.170.0130.00722.96
8.2.160.0080.00522.96
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0040.00419.67
8.2.110.0070.00420.96
8.2.100.0030.00717.84
8.2.90.0090.00020.55
8.2.80.0030.00618.04
8.2.70.0040.00418.16
8.2.60.0100.00018.22
8.2.50.0000.00918.10
8.2.40.0100.00019.24
8.2.30.0070.00019.37
8.2.20.0070.00018.08
8.2.10.0000.00719.25
8.2.00.0030.00519.34
8.1.280.0150.00025.92
8.1.270.0090.00020.80
8.1.260.0000.00826.35
8.1.250.0070.01028.09
8.1.240.0070.00423.75
8.1.230.0080.00420.90
8.1.220.0040.00417.77
8.1.210.0030.00618.96
8.1.200.0040.00417.35
8.1.190.0090.00017.25
8.1.180.0040.00418.10
8.1.170.0040.00418.59
8.1.160.0050.00318.82
8.1.150.0000.00718.96
8.1.140.0000.00822.13
8.1.130.0070.00020.22
8.1.120.0070.00017.53
8.1.110.0070.00017.39
8.1.100.0000.00717.49
8.1.90.0040.00417.46
8.1.80.0000.00817.39
8.1.70.0000.00717.52
8.1.60.0040.00417.45
8.1.50.0030.00617.50
8.1.40.0040.00417.47
8.1.30.0030.00517.69
8.1.20.0040.00417.58
8.1.10.0080.00017.53
8.1.00.0000.00817.59
8.0.300.0040.00419.89
8.0.290.0050.00316.63
8.0.280.0070.00018.47
8.0.270.0030.00317.20
8.0.260.0030.00318.46
8.0.250.0000.00716.97
8.0.240.0030.00516.91
8.0.230.0000.01016.86
8.0.220.0000.00816.91
8.0.210.0030.00316.80
8.0.200.0030.00316.98
8.0.190.0070.00016.95
8.0.180.0000.00716.91
8.0.170.0000.00816.93
8.0.160.0070.00016.93
8.0.150.0030.00616.74
8.0.140.0070.00016.76
8.0.130.0050.00013.22
8.0.120.0030.00616.83
8.0.110.0050.00316.86
8.0.100.0040.00416.93
8.0.90.0080.00016.92
8.0.80.0120.00616.85
8.0.70.0000.00816.80
8.0.60.0050.00316.96
8.0.50.0030.00516.81
8.0.30.0120.00616.82
8.0.20.0190.00017.36
8.0.10.0030.00617.07
8.0.00.0100.00816.71
7.4.330.0000.00615.55
7.4.320.0030.00316.62
7.4.300.0040.00416.43
7.4.290.0000.00716.51
7.4.280.0030.00516.57
7.4.270.0040.00416.63
7.4.260.0030.00316.51
7.4.250.0040.00416.59
7.4.240.0000.00716.60
7.4.230.0030.00316.34
7.4.220.0000.00716.64
7.4.210.0100.00316.49
7.4.200.0030.00316.65
7.4.160.0060.00916.56
7.4.140.0110.00617.86
7.4.130.0120.00416.64
7.4.120.0100.01316.71
7.4.110.0100.01316.48
7.4.100.0140.00716.50
7.4.90.0180.00616.55
7.4.80.0000.01919.39
7.4.70.0070.01116.41
7.4.60.0120.00316.60
7.4.50.0130.00316.54
7.4.40.0120.00416.56
7.4.00.0100.00614.60
7.3.330.0000.00713.37
7.3.320.0000.00613.39
7.3.310.0040.00416.52
7.3.300.0070.00016.46
7.3.290.0000.00716.30
7.3.280.0090.00916.34
7.3.260.0100.00816.48
7.3.240.0090.00916.43
7.3.230.0100.00616.37
7.3.210.0060.01216.37
7.3.200.0000.01916.37
7.3.190.0110.00616.55
7.3.180.0090.00616.20
7.3.170.0030.01316.29
7.3.160.0000.01616.60
7.3.00.0490.00614.74
7.2.330.0160.00316.74
7.2.320.0060.01316.51
7.2.310.0130.00316.75
7.2.300.0110.01016.60
7.2.290.0110.00516.71
7.2.130.0350.01614.85
7.2.120.0740.01014.95
7.2.110.0380.00715.10
7.2.100.0390.02014.88
7.2.90.0400.00714.82
7.2.80.0400.01014.68
7.2.70.0460.01314.84
7.2.60.0520.01015.28
7.2.50.0360.00015.15
7.2.40.0290.01015.09
7.2.30.0410.00614.98
7.2.20.0460.00314.90
7.2.10.0520.00715.19
7.2.00.0400.01014.90
7.1.250.0320.00313.77

preferences:
60.42 ms | 400 KiB | 5 Q