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.60.0090.01216.88
8.3.50.0110.00416.52
8.3.40.0040.01118.84
8.3.30.0060.00918.78
8.3.20.0000.00820.34
8.3.10.0000.00723.65
8.3.00.0070.00717.72
8.2.180.0140.00716.75
8.2.170.0000.01522.96
8.2.160.0120.00320.23
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0040.00419.39
8.2.120.0040.00426.35
8.2.110.0080.00321.04
8.2.100.0000.01118.22
8.2.90.0000.00819.17
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0040.00418.03
8.2.50.0060.00318.10
8.2.40.0090.00020.61
8.2.30.0000.00719.33
8.2.20.0040.00418.04
8.2.10.0070.00018.01
8.2.00.0050.00318.19
8.1.280.0070.00725.92
8.1.270.0060.00322.24
8.1.260.0070.00726.35
8.1.250.0070.00028.09
8.1.240.0040.00723.96
8.1.230.0070.00318.97
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0100.00017.22
8.1.190.0000.01116.88
8.1.180.0030.00618.10
8.1.170.0040.00418.65
8.1.160.0000.00719.03
8.1.150.0070.00020.67
8.1.140.0000.00719.63
8.1.130.0060.00318.80
8.1.120.0000.00717.53
8.1.110.0000.01017.51
8.1.100.0000.00717.43
8.1.90.0040.00417.37
8.1.80.0030.00617.36
8.1.70.0000.00717.50
8.1.60.0030.00517.63
8.1.50.0030.00617.51
8.1.40.0000.00717.62
8.1.30.0000.00817.70
8.1.20.0040.00417.57
8.1.10.0020.00517.61
8.1.00.0040.00417.56
8.0.300.0000.00718.77
8.0.290.0040.00416.88
8.0.280.0030.00318.46
8.0.270.0070.00017.27
8.0.260.0060.00016.83
8.0.250.0000.00717.07
8.0.240.0000.00716.92
8.0.230.0000.01017.02
8.0.220.0030.00317.00
8.0.210.0000.00716.97
8.0.200.0000.00617.09
8.0.190.0040.00417.07
8.0.180.0000.00916.87
8.0.170.0000.00716.99
8.0.160.0040.00417.07
8.0.150.0040.00416.88
8.0.140.0070.00016.82
8.0.130.0000.00513.38
8.0.120.0040.00416.96
8.0.110.0000.00817.03
8.0.100.0040.00416.90
8.0.90.0040.00416.97
8.0.80.0090.01217.00
8.0.70.0080.00016.82
8.0.60.0000.00716.93
8.0.50.0020.00516.80
8.0.30.0090.01017.04
8.0.20.0100.00917.42
8.0.10.0000.00716.98
8.0.00.0120.00616.71
7.4.330.0020.00215.55
7.4.320.0040.00416.61
7.4.300.0000.00616.60
7.4.290.0050.00516.56
7.4.280.0000.00916.60
7.4.270.0060.00016.44
7.4.260.0030.00313.35
7.4.250.0040.00416.57
7.4.240.0070.00016.39
7.4.230.0000.00716.41
7.4.220.0060.01216.66
7.4.210.0050.01316.67
7.4.200.0030.00316.71
7.4.160.0070.01016.60
7.4.150.0130.00617.40
7.4.140.0120.00717.86
7.4.130.0210.00016.48
7.4.120.0120.00816.58
7.4.110.0090.00816.63
7.4.100.0060.01216.63
7.4.90.0140.00316.52
7.4.80.0130.01019.39
7.4.70.0060.00916.57
7.4.60.0090.01216.71
7.4.50.0000.01416.45
7.4.40.0030.01316.67
7.4.30.0030.01316.57
7.4.10.0070.01115.14
7.4.00.0050.00914.96
7.3.330.0060.00013.30
7.3.320.0000.00613.15
7.3.310.0040.00416.25
7.3.300.0000.00616.41
7.3.290.0030.00316.29
7.3.280.0090.00816.40
7.3.270.0090.00817.40
7.3.260.0070.01016.50
7.3.250.0110.01016.46
7.3.240.0080.00816.46
7.3.230.0110.00716.61
7.3.210.0120.00916.54
7.3.200.0090.00616.39
7.3.190.0070.01016.39
7.3.180.0060.01016.59
7.3.170.0090.00916.42
7.3.160.0080.00816.53
7.3.130.0070.01014.75
7.3.120.0060.01315.02
7.3.110.0060.01214.84
7.3.100.0070.00714.53
7.3.90.0040.00714.90
7.3.80.0030.01014.91
7.3.70.0030.01014.62
7.3.60.0060.00314.91
7.3.50.0060.00314.66
7.3.40.0040.01114.87
7.3.30.0080.00414.81
7.3.20.0110.00016.69
7.3.10.0000.01316.72
7.3.00.0030.01016.62
7.2.330.0060.01216.66
7.2.320.0180.00416.70
7.2.310.0170.00316.56
7.2.300.0070.01016.55
7.2.290.0120.00316.60
7.2.260.0020.01315.06
7.2.250.0070.01115.02
7.2.240.0070.00715.19
7.2.230.0030.01215.28
7.2.220.0000.01515.09
7.2.210.0070.00715.01
7.2.200.0030.01215.27
7.2.190.0080.00615.12
7.2.180.0030.00614.96
7.2.170.0090.00615.10
7.2.160.0000.01214.95
7.2.150.0120.00316.78
7.2.140.0070.00716.90
7.2.130.0070.01117.07
7.2.120.0030.01216.96
7.2.110.0000.01016.85
7.2.100.0030.00616.92
7.2.90.0090.00616.95
7.2.80.0000.01617.00
7.2.70.0090.00617.12
7.2.60.0050.00817.04
7.2.50.0150.00316.99
7.2.40.0030.01016.93
7.2.30.0110.00417.06
7.2.20.0060.00917.04
7.2.10.0080.00416.79
7.2.00.0030.00617.04
7.1.330.0060.00915.71
7.1.320.0030.01015.78
7.1.310.0000.01215.74
7.1.300.0030.01215.86
7.1.290.0090.00315.55
7.1.280.0030.00615.96
7.1.270.0070.00715.64
7.1.260.0070.00715.84
7.1.250.0070.00715.88
7.1.240.0070.00715.63
7.1.230.0030.00815.79
7.1.220.0120.00015.61
7.1.210.0070.00715.75
7.1.200.0020.01115.77
7.1.190.0040.01115.99
7.1.180.0030.01415.61
7.1.170.0080.00415.92
7.1.160.0030.01015.95
7.1.150.0110.00415.46
7.1.140.0090.00315.93
7.1.130.0000.01415.81
7.1.120.0070.00715.78
7.1.110.0000.00915.98
7.1.100.0060.00615.88
7.1.90.0000.01215.85
7.1.80.0110.00015.86
7.1.70.0060.00516.43
7.1.60.0110.00925.50
7.1.50.0150.00625.17
7.1.40.0130.00725.02
7.1.30.0100.01125.16
7.1.20.0130.01225.27
7.1.10.0020.01216.25
7.1.00.0040.00916.31
7.0.330.0040.00815.16
7.0.320.0070.00315.55
7.0.310.0070.00415.07
7.0.300.0070.01015.17
7.0.290.0040.01115.54
7.0.280.0110.00415.50
7.0.270.0040.00415.66
7.0.260.0070.01015.49
7.0.250.0060.00315.45
7.0.240.0060.00315.52
7.0.230.0070.00715.20
7.0.220.0070.01015.43
7.0.210.0030.00715.42
7.0.200.0050.00716.15
7.0.190.0020.00915.77
7.0.180.0080.00615.97
7.0.170.0030.00916.01
7.0.160.0030.01215.90
7.0.150.0060.00815.89
7.0.140.0060.00815.98
7.0.130.0080.00516.06
7.0.120.0060.00515.95
7.0.110.0050.00815.80
7.0.100.0070.00615.81
7.0.90.0080.00615.74
7.0.80.0030.00815.93
7.0.70.0030.01015.70
7.0.60.0070.00615.88
7.0.50.0050.00815.90
7.0.40.0050.00714.89
7.0.30.0020.01114.86
7.0.20.0040.00714.89
7.0.10.0060.00915.04
7.0.00.0080.00614.95
5.6.400.0030.01314.29
5.6.390.0030.01014.05
5.6.380.0070.00714.55
5.6.370.0030.00814.42
5.6.360.0100.00714.37
5.6.350.0000.01514.28
5.6.340.0070.00714.30
5.6.330.0030.01014.41
5.6.320.0030.00914.40
5.6.310.0000.00814.30
5.6.300.0060.00614.30
5.6.290.0030.01014.64
5.6.280.0030.01414.29
5.6.270.0000.00814.29
5.6.260.0110.00014.33
5.6.250.0030.01214.31
5.6.240.0080.00414.23
5.6.230.0060.00914.23
5.6.220.0040.00814.27
5.6.210.0080.00414.52
5.6.200.0040.01114.74
5.6.190.0060.00314.45
5.6.180.0040.00714.38
5.6.170.0070.00714.36
5.6.160.0000.01414.63
5.6.150.0070.00414.26
5.6.140.0070.00714.20
5.6.130.0080.00314.46
5.6.120.0030.01014.63
5.6.110.0180.00014.64
5.6.100.0090.00614.21
5.6.90.0060.00914.54
5.6.80.0030.01414.14
5.6.70.0090.00414.40
5.6.60.0000.01314.31
5.6.50.0030.01014.04
5.6.40.0030.00914.34
5.6.30.0030.01014.06
5.6.20.0000.01414.36
5.6.10.0000.01114.51
5.6.00.0040.00814.70

preferences:
43.83 ms | 400 KiB | 5 Q