3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[ {"recipient_name":"John D", "phone_number":"123456"}, {"recipient_name":"Doe J", "phone_number":"654321"}, {"recipient_name":"Jon Do", "phone_number":"112233"} ]'; $myLargerArray = json_decode($json, true); $myObjArray = (object)['message_recipients' => array()]; $size = count($myLargerArray); for( $j = 0; $j < $size; $j++ ) { $myRecipientsObj->recipient_name = $myLargerArray[$j]['recipient_name']; $myRecipientsObj->phone_number = $myLargerArray[$j]['phone_number']; // var_dump($myRecipientsObj); // This outputs the correct data added from [$j] array_push($myObjArray->message_recipients, clone $myRecipientsObj); var_dump($myObjArray->message_recipients); // The output shows array elements are being overwritten at each loop iteration }

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.0150.00318.68
8.3.50.0170.00516.52
8.3.40.0060.01218.92
8.3.30.0060.00918.70
8.3.20.0040.00420.89
8.3.10.0000.00820.98
8.3.00.0040.00421.73
8.2.180.0230.00325.92
8.2.170.0100.01018.95
8.2.160.0070.00722.96
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0070.00026.16
8.2.120.0000.00719.77
8.2.110.0100.00020.51
8.2.100.0070.00418.03
8.2.90.0040.00417.91
8.2.80.0060.00319.12
8.2.70.0040.00418.04
8.2.60.0000.00918.06
8.2.50.0080.00018.10
8.2.40.0040.00421.05
8.2.30.0080.00020.33
8.2.20.0040.00418.04
8.2.10.0070.00319.09
8.2.00.0000.00819.38
8.1.280.0090.00925.92
8.1.270.0050.00320.76
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0070.00322.54
8.1.230.0070.00422.70
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0040.00417.23
8.1.180.0060.00318.10
8.1.170.0000.00818.44
8.1.160.0070.00018.81
8.1.150.0050.00318.89
8.1.140.0000.00720.27
8.1.130.0040.00518.76
8.1.120.0000.00917.52
8.1.110.0020.00717.47
8.1.100.0010.00917.47
8.1.90.0060.00417.43
8.1.80.0050.00417.45
8.1.70.0000.00917.38
8.1.60.0020.00617.57
8.1.50.0050.00317.54
8.1.40.0070.00217.62
8.1.30.0030.00717.61
8.1.20.0030.00717.63
8.1.10.0040.00417.62
8.1.00.0050.00417.47
8.0.300.0030.00620.08
8.0.290.0040.00416.63
8.0.280.0080.00018.46
8.0.270.0000.00716.83
8.0.260.0060.00217.86
8.0.250.0050.00317.10
8.0.240.0030.00517.17
8.0.230.0050.00317.15
8.0.220.0040.00617.05
8.0.210.0030.00517.10
8.0.200.0050.00317.10
8.0.190.0030.00517.13
8.0.180.0030.00517.14
8.0.170.0080.00017.19
8.0.160.0080.00117.13
8.0.150.0060.00417.00
8.0.140.0100.00117.01
8.0.130.0080.00415.88
8.0.120.0070.00417.02
8.0.110.0080.00317.05
8.0.100.0060.00617.02
8.0.90.0080.00417.05
8.0.80.0120.00517.03
8.0.70.0070.00417.00
8.0.60.0060.00517.01
8.0.50.0070.00417.07
8.0.30.0120.00317.12
8.0.20.0070.00716.95
8.0.10.0090.00817.10
8.0.00.0110.00617.07
7.4.330.0080.00216.44
7.4.320.0130.00216.87
7.4.300.0140.00216.98
7.4.290.0080.00616.96
7.4.280.0060.00616.90
7.4.270.0140.00116.84
7.4.260.0070.00516.81
7.4.250.0090.00316.73
7.4.240.0060.00816.76
7.4.230.0090.00616.80
7.4.220.0060.00716.79
7.4.210.0100.00516.70
7.4.200.0110.00216.69
7.4.190.0100.00516.94
7.4.180.0080.00816.97
7.4.160.0050.01416.61
7.4.150.0140.00416.75
7.4.140.0130.00517.04
7.4.130.0100.00916.67
7.4.120.0130.00716.69
7.4.110.0100.00916.68
7.4.100.0140.00716.62
7.4.90.0150.00416.73
7.4.80.0170.00317.36
7.4.70.0130.00716.66
7.4.60.0150.00416.59
7.4.50.0120.00816.55
7.4.40.0150.00516.57
7.4.30.0170.00616.58
7.4.20.0110.00716.60
7.4.10.0110.00816.56
7.4.00.0080.00916.45
7.3.330.0090.00515.54
7.3.320.0090.00515.65
7.3.310.0100.00516.67
7.3.300.0110.00316.63
7.3.290.0050.01116.71
7.3.280.0110.00616.64
7.3.270.0130.00716.72
7.3.260.0120.00716.54
7.3.250.0140.00516.62
7.3.240.0170.00316.69
7.3.230.0130.00616.65
7.3.220.0160.00416.57
7.3.210.0150.00516.63
7.3.200.0170.00316.53
7.3.190.0140.00416.59
7.3.180.0120.00816.63
7.3.170.0150.00416.51
7.3.160.0140.00516.55
7.3.150.0110.00816.56
7.3.140.0150.00616.54
7.3.130.0130.00716.48
7.3.120.0120.00616.21
7.3.110.0110.00916.21
7.3.100.0110.00716.13
7.3.90.0130.00616.13
7.3.80.0140.00416.14
7.3.70.0120.00716.16
7.3.60.0090.01016.22
7.3.50.0110.00815.47
7.3.40.0100.00915.56
7.3.30.0090.00715.52
7.3.20.0090.00816.58
7.3.10.0110.00816.59
7.3.00.0100.00616.59
7.2.340.0180.00416.72
7.2.330.0170.00616.62
7.2.320.0150.00616.72
7.2.310.0130.00916.77
7.2.300.0150.00816.68
7.2.290.0140.00816.67
7.2.280.0130.00716.68
7.2.270.0150.00716.70
7.2.260.0150.00616.69
7.2.250.0140.00716.68
7.2.240.0150.00516.34
7.2.230.0140.00516.41
7.2.220.0110.00916.38
7.2.210.0120.00716.33
7.2.200.0140.00716.34
7.2.190.0130.00716.37
7.2.180.0090.00915.78
7.2.170.0110.00815.69
7.2.160.0110.00815.76
7.2.150.0140.00716.75
7.2.140.0110.00916.76
7.2.130.0140.00916.86
7.2.120.0100.01016.76
7.2.110.0110.00816.85
7.2.100.0130.00716.83
7.2.90.0100.00816.83
7.2.80.0110.00716.75
7.2.70.0110.00616.79
7.2.60.0100.00816.87
7.2.50.0110.00916.85
7.2.40.0170.00517.05
7.2.30.0150.00717.04
7.2.20.0110.00717.06
7.2.10.0110.00817.04
7.2.00.0120.00517.10
7.1.330.0160.00716.06
7.1.320.0150.00615.96
7.1.310.0170.00515.98
7.1.300.0150.00615.94
7.1.290.0170.00615.94
7.1.280.0120.00715.83
7.1.270.0130.00615.83
7.1.260.0140.00715.79
7.1.250.0090.01115.76
7.1.240.0140.00815.95
7.1.230.0150.00615.91
7.1.220.0180.00415.94
7.1.210.0150.00315.89
7.1.200.0140.00615.76
7.1.190.0110.00915.83
7.1.180.0150.00515.86
7.1.170.0210.00816.21
7.1.160.0130.00716.33
7.1.150.0170.00816.26
7.1.140.0140.00816.28
7.1.130.0120.01016.21
7.1.120.0140.00816.27
7.1.110.0190.00616.22
7.1.100.0140.00716.38
7.1.90.0130.01116.23
7.1.80.0160.00616.19
7.1.70.0170.00516.25
7.1.60.0110.01016.24
7.1.50.0150.00916.20
7.1.40.0130.00916.32
7.1.30.0160.00616.27
7.1.20.0170.00516.26
7.1.10.0160.00716.24
7.1.00.0160.00916.32

preferences:
74.32 ms | 401 KiB | 5 Q