3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x=['a','b']; echo "Original\n\n"; for ($i = 0; $i < count($x); $i++) { $target_path = $x[$i]; if($i == 0 ){ $test1 = $target_path; } if($i == 1 ){ $test2 = $target_path; } //This part should output only 2 results but it outputs something different. echo $test1." img 1 <br>"; echo $test2." img 2 <br>"; } echo "Rishi\n\n"; $target_path_arr = array(); for ($i = 0; $i < count($x); $i++) { $target_path = $x[$i]; $target_path_arr[] = $target_path; // use this in future echo $target_path." img ".($i+1)."<br>"; }

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.40.0120.00318.83
8.3.30.0120.00318.63
8.3.20.0050.00320.16
8.3.10.0040.00423.70
8.3.00.0070.00717.66
8.2.170.0140.00022.96
8.2.160.0140.00020.39
8.2.150.0090.00024.18
8.2.140.0050.00324.66
8.2.130.0000.00719.27
8.2.120.0040.00426.35
8.2.110.0070.00320.52
8.2.100.0080.00418.03
8.2.90.0000.00819.36
8.2.80.0060.00317.97
8.2.70.0000.01217.60
8.2.60.0050.00317.93
8.2.50.0030.00518.10
8.2.40.0030.00520.65
8.2.30.0050.00219.34
8.2.20.0000.00718.09
8.2.10.0000.00718.05
8.2.00.0040.00418.13
8.1.270.0000.00822.20
8.1.260.0050.00226.35
8.1.250.0060.00328.09
8.1.240.0060.00319.21
8.1.230.0060.00919.16
8.1.220.0080.00017.74
8.1.210.0030.00518.77
8.1.200.0060.00317.25
8.1.190.0030.00617.10
8.1.180.0000.00818.10
8.1.170.0040.00418.39
8.1.160.0000.00719.01
8.1.150.0000.00820.73
8.1.140.0000.00719.57
8.1.130.0090.00018.82
8.1.120.0030.00317.54
8.1.110.0060.00317.45
8.1.100.0040.00417.47
8.1.90.0040.00417.50
8.1.80.0040.00417.36
8.1.70.0000.00817.47
8.1.60.0020.00517.43
8.1.50.0040.00417.55
8.1.40.0000.00717.48
8.1.30.0050.00317.68
8.1.20.0000.00717.58
8.1.10.0040.00417.59
8.1.00.0000.00717.41
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0030.00318.45
8.0.270.0070.00017.27
8.0.260.0030.00316.86
8.0.250.0030.00317.05
8.0.240.0030.00317.05
8.0.230.0080.00017.06
8.0.220.0000.00717.02
8.0.210.0000.00716.93
8.0.200.0000.00716.98
8.0.190.0050.00317.00
8.0.180.0030.00616.89
8.0.170.0000.00717.02
8.0.160.0040.00417.05
8.0.150.0040.00416.93
8.0.140.0000.00716.97
8.0.130.0030.00313.36
8.0.120.0040.00416.84
8.0.110.0000.00716.80
8.0.100.0040.00416.87
8.0.90.0040.00216.82
8.0.80.0160.00617.01
8.0.70.0080.00016.84
8.0.60.0040.00416.91
8.0.50.0000.00916.86
8.0.30.0150.00417.19
8.0.20.0130.00617.40
8.0.10.0000.00717.05
8.0.00.0150.00317.13
7.4.330.0050.00015.55
7.4.320.0030.00316.60
7.4.300.0030.00316.60
7.4.290.0030.00716.37
7.4.280.0080.00016.61
7.4.270.0000.00716.39
7.4.260.0030.00313.31
7.4.250.0040.00416.43
7.4.240.0040.00416.47
7.4.230.0030.00316.51
7.4.220.0140.01016.67
7.4.210.0100.00516.59
7.4.200.0070.00016.40
7.4.160.0050.01216.52
7.4.150.0090.00917.40
7.4.140.0070.01217.86
7.4.130.0200.00016.55
7.4.120.0130.00716.61
7.4.110.0080.00816.46
7.4.100.0110.00516.50
7.4.90.0150.00616.67
7.4.80.0080.01519.39
7.4.70.0030.01416.50
7.4.60.0090.00916.59
7.4.50.0000.01216.63
7.4.40.0070.01016.63
7.4.30.0100.01316.74
7.4.10.0030.01316.57
7.4.00.0050.01315.61
7.3.330.0030.00313.28
7.3.320.0050.00013.33
7.3.310.0040.00416.46
7.3.300.0030.00316.43
7.3.290.0070.00016.39
7.3.280.0090.00616.36
7.3.270.0150.00317.40
7.3.260.0100.00816.40
7.3.250.0080.01316.45
7.3.240.0110.00516.46
7.3.230.0150.00316.46
7.3.210.0110.01016.56
7.3.200.0140.00716.51
7.3.190.0030.01916.49
7.3.180.0030.01316.55
7.3.170.0100.01016.52
7.3.160.0120.00316.57
7.3.130.0070.01116.45
7.3.120.0030.01316.45
7.3.110.0030.01016.21
7.3.100.0060.00616.34
7.3.90.0160.00016.41
7.3.80.0060.00916.34
7.3.70.0040.01216.22
7.3.60.0070.00716.25
7.3.50.0080.00516.52
7.3.40.0000.01316.29
7.3.30.0000.01616.24
7.3.20.0030.00718.19
7.3.10.0090.00917.02
7.3.00.0090.01016.86
7.2.330.0070.01016.84
7.2.320.0170.00016.41
7.2.310.0090.00916.77
7.2.300.0120.00616.83
7.2.290.0080.00816.74
7.2.260.0100.01016.52
7.2.250.0070.01416.44
7.2.240.0030.01316.68
7.2.230.0070.01116.54
7.2.220.0100.00716.81
7.2.210.0120.00316.50
7.2.200.0160.00316.65
7.2.190.0070.01016.32
7.2.180.0090.00916.58
7.2.170.0030.01316.59
7.2.160.0110.00716.53
7.2.150.0070.01018.39
7.2.140.0100.00718.58
7.2.130.0110.00717.17
7.2.120.0080.01017.30
7.2.110.0120.00817.22
7.2.100.0080.00817.24
7.2.90.0110.00917.14
7.2.80.0060.00817.23
7.2.70.0060.00817.11
7.2.60.0080.00817.09
7.2.50.0070.01117.20
7.2.40.0050.01117.24
7.2.30.0090.00917.27
7.2.20.0120.00617.05
7.2.10.0070.00817.15
7.2.00.0070.00817.94
7.1.330.0130.00017.42
7.1.320.0030.01317.34
7.1.310.0060.01217.34
7.1.300.0070.00717.22
7.1.290.0040.00817.27
7.1.280.0130.00317.19
7.1.270.0080.00717.48
7.1.260.0090.00617.33
7.1.250.0070.01116.04
7.1.240.0120.00317.26
7.1.230.0100.00617.47
7.1.220.0030.01017.20
7.1.210.0080.00417.40
7.1.200.0080.00416.57
7.1.190.0070.00717.26
7.1.180.0000.01617.16
7.1.170.0090.00617.28
7.1.160.0080.00817.28
7.1.150.0070.01017.32
7.1.140.0000.01317.37
7.1.130.0080.00817.44
7.1.120.0040.01217.16
7.1.110.0070.01017.40
7.1.100.0060.00817.55
7.1.90.0080.00617.41
7.1.80.0040.01117.48
7.1.70.0080.00717.30
7.1.60.0110.01026.30
7.1.50.0180.01126.08
7.1.40.0080.01125.99
7.1.30.0130.00825.84
7.1.20.0100.01125.93
7.1.10.0070.01117.07
7.1.00.0050.00916.86
7.0.330.0110.00717.22
7.0.320.0040.01216.93
7.0.310.0070.00717.00
7.0.300.0000.01316.95
7.0.290.0000.01517.12
7.0.280.0110.00017.18
7.0.270.0040.01117.07
7.0.260.0070.01016.96
7.0.250.0140.00016.93
7.0.240.0030.01017.13
7.0.230.0080.00616.98
7.0.220.0080.00416.92
7.0.210.0030.01316.85
7.0.200.0050.01116.94
7.0.190.0070.00716.97
7.0.180.0040.01016.62
7.0.170.0090.00416.70
7.0.160.0070.00916.52
7.0.150.0050.01216.59
7.0.140.0040.00916.55
7.0.130.0090.00416.89
7.0.120.0030.01016.68
7.0.110.0080.00716.64
7.0.100.0040.01216.69
7.0.90.0060.01116.72
7.0.80.0070.00916.73
7.0.70.0110.00316.65
7.0.60.0080.00516.52
7.0.50.0050.00816.78
7.0.40.0110.00315.71
7.0.30.0080.00515.69
7.0.20.0060.00715.66
7.0.10.0080.00915.66
7.0.00.0060.00815.76
5.6.400.0130.00316.15
5.6.390.0100.00316.05
5.6.380.0070.00715.87
5.6.370.0040.00816.29
5.6.360.0070.01016.06
5.6.350.0070.00715.66
5.6.340.0060.00915.84
5.6.330.0090.00316.09
5.6.320.0070.00716.03
5.6.310.0040.01216.10
5.6.300.0070.01015.79
5.6.290.0040.00716.12
5.6.280.0000.01315.98
5.6.270.0060.00615.98
5.6.260.0090.00016.00
5.6.250.0100.00715.82
5.6.240.0090.00915.94
5.6.230.0030.01015.87
5.6.220.0030.00915.95
5.6.210.0090.00616.13
5.6.200.0040.01115.96
5.6.190.0060.00915.94
5.6.180.0030.01315.89
5.6.170.0120.00915.93
5.6.160.0030.01615.98
5.6.150.0130.00716.00
5.6.140.0030.01315.98
5.6.130.0000.01216.00
5.6.120.0070.00715.91
5.6.110.0030.01416.08
5.6.100.0040.01415.89
5.6.90.0040.01115.84
5.6.80.0090.00615.91
5.6.70.0060.00915.76
5.6.60.0030.01216.04
5.6.50.0060.00316.13
5.6.40.0100.00715.85
5.6.30.0030.01015.83
5.6.20.0030.01215.94
5.6.10.0060.00915.77
5.6.00.0080.00415.92

preferences:
42.56 ms | 400 KiB | 5 Q