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 "\n\nRishi:\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.60.0120.00316.63
8.3.50.0090.00616.46
8.3.40.0040.01118.67
8.3.30.0060.00918.92
8.3.20.0030.01320.28
8.3.10.0000.00723.61
8.3.00.0070.00717.72
8.2.180.0150.00716.88
8.2.170.0090.00622.96
8.2.160.0100.00320.51
8.2.150.0040.00424.18
8.2.140.0020.00524.66
8.2.130.0040.00419.19
8.2.120.0040.00426.35
8.2.110.0040.00422.21
8.2.100.0070.00418.03
8.2.90.0040.00419.22
8.2.80.0050.00318.05
8.2.70.0080.00417.38
8.2.60.0040.00418.04
8.2.50.0040.00418.10
8.2.40.0040.00422.36
8.2.30.0000.00819.20
8.2.20.0040.00418.04
8.2.10.0040.00418.11
8.2.00.0000.00718.16
8.1.280.0100.00725.92
8.1.270.0040.00422.06
8.1.260.0110.00426.35
8.1.250.0000.00828.09
8.1.240.0030.00623.79
8.1.230.0070.00417.89
8.1.220.0000.00817.77
8.1.210.0080.00018.77
8.1.200.0030.00617.35
8.1.190.0090.00317.10
8.1.180.0030.00618.10
8.1.170.0080.00018.54
8.1.160.0040.00418.88
8.1.150.0040.00420.61
8.1.140.0040.00419.52
8.1.130.0080.00418.91
8.1.120.0040.00417.37
8.1.110.0030.00617.50
8.1.100.0040.00417.39
8.1.90.0040.00417.39
8.1.80.0000.00817.47
8.1.70.0050.00317.35
8.1.60.0000.00817.45
8.1.50.0040.00417.54
8.1.40.0000.00817.54
8.1.30.0040.00417.61
8.1.20.0000.00717.67
8.1.10.0040.00417.55
8.1.00.0030.00517.54
8.0.300.0030.00718.77
8.0.290.0040.00416.88
8.0.280.0070.00018.49
8.0.270.0050.00217.19
8.0.260.0000.00616.95
8.0.250.0030.00316.93
8.0.240.0030.00517.01
8.0.230.0000.01016.89
8.0.220.0000.00716.98
8.0.210.0030.00316.94
8.0.200.0000.00617.05
8.0.190.0000.00817.04
8.0.180.0050.00516.89
8.0.170.0030.00317.02
8.0.160.0030.00616.88
8.0.150.0000.00716.82
8.0.140.0040.00416.77
8.0.130.0060.00013.33
8.0.120.0070.00016.97
8.0.110.0000.00716.86
8.0.100.0040.00416.86
8.0.90.0000.00716.91
8.0.80.0180.00316.91
8.0.70.0050.00216.77
8.0.60.0040.00416.81
8.0.50.0040.00416.92
8.0.30.0110.00717.14
8.0.20.0110.00917.40
8.0.10.0030.00616.99
8.0.00.0060.01216.67
7.4.330.0050.00015.55
7.4.320.0070.00016.64
7.4.300.0030.00316.61
7.4.290.0060.00316.56
7.4.280.0040.00416.50
7.4.270.0000.00616.42
7.4.260.0000.00513.18
7.4.250.0040.00416.41
7.4.240.0000.00816.57
7.4.230.0000.00716.43
7.4.220.0130.00716.56
7.4.210.0070.00716.57
7.4.200.0070.00016.64
7.4.160.0100.00916.52
7.4.150.0070.01117.40
7.4.140.0090.00917.86
7.4.130.0140.00516.61
7.4.120.0100.01216.57
7.4.110.0070.01016.43
7.4.100.0140.00416.76
7.4.90.0050.01116.45
7.4.80.0030.01219.39
7.4.70.0030.01316.46
7.4.60.0130.00316.52
7.4.50.0100.00716.54
7.4.40.0040.01216.61
7.4.30.0090.00916.60
7.4.00.0060.01214.97
7.3.330.0060.00013.23
7.3.320.0000.00513.11
7.3.310.0000.00716.39
7.3.300.0040.00416.43
7.3.290.0000.00616.38
7.3.280.0100.00816.36
7.3.270.0140.00417.40
7.3.260.0090.00916.49
7.3.250.0070.01116.50
7.3.240.0070.00916.47
7.3.230.0030.01516.62
7.3.210.0070.01016.45
7.3.200.0070.01016.69
7.3.190.0070.01016.50
7.3.180.0140.00316.44
7.3.170.0160.00616.43
7.3.160.0040.01216.38
7.3.120.0050.01314.89
7.3.110.0020.00915.04
7.3.100.0080.00814.95
7.3.90.0090.00714.90
7.3.80.0080.00514.94
7.3.70.0070.00714.92
7.3.60.0060.00914.71
7.3.50.0050.01014.97
7.3.40.0030.01214.81
7.3.30.0060.00814.81
7.3.20.0100.00316.69
7.3.10.0110.00316.67
7.3.00.0110.00716.69
7.2.330.0120.00816.68
7.2.320.0040.01916.48
7.2.310.0060.01316.52
7.2.300.0090.01216.54
7.2.290.0060.01116.71
7.2.250.0110.00715.05
7.2.240.0080.01014.97
7.2.230.0080.01015.13
7.2.220.0050.01014.99
7.2.210.0030.01115.20
7.2.200.0070.00715.14
7.2.190.0020.01314.95
7.2.180.0030.00915.06
7.2.170.0030.01414.95
7.2.160.0100.00714.99
7.2.150.0000.01816.82
7.2.140.0030.01416.96
7.2.130.0110.00817.01
7.2.120.0070.01016.75
7.2.110.0030.01316.41
7.2.100.0030.01316.79
7.2.90.0070.01117.01
7.2.80.0120.00417.06
7.2.70.0070.00716.85
7.2.60.0060.00916.78
7.2.50.0000.01417.07
7.2.40.0000.01416.93
7.2.30.0000.01417.09
7.2.20.0070.00717.07
7.2.10.0100.00717.08
7.2.00.0030.00618.24
7.1.330.0030.00815.72
7.1.320.0040.00715.78
7.1.310.0050.00815.75
7.1.300.0030.01015.78
7.1.290.0020.01215.69
7.1.280.0100.00515.66
7.1.270.0050.00815.95
7.1.260.0060.01115.86
7.1.250.0040.01115.79
7.1.200.0060.00615.82
7.1.100.0070.00718.13
7.1.70.0030.01017.18
7.1.60.0220.00634.82
7.1.50.0210.00634.79
7.1.40.0100.01734.64
7.1.30.0270.00034.50
7.1.20.0130.01334.61
7.1.10.0080.00616.66
7.1.00.0070.00716.70
7.0.200.0130.00316.80
7.0.190.0030.00916.61
7.0.180.0090.00416.33
7.0.170.0030.01116.34
7.0.160.0000.01316.30
7.0.150.0030.01116.22
7.0.140.0090.00616.39
7.0.130.0080.00816.66
7.0.120.0040.01116.52
7.0.110.0030.01716.47
7.0.100.0030.01016.09
7.0.90.0000.01416.25
7.0.80.0060.00616.42
7.0.70.0000.01316.24
7.0.60.0100.00316.18
7.0.50.0030.01016.52
7.0.40.0030.01016.65
7.0.30.0000.01316.52
7.0.20.0040.00916.30
7.0.10.0070.00716.37
7.0.00.0070.00716.37

preferences:
42.92 ms | 401 KiB | 5 Q