3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['1','a','b','c']; echo "$array[2]". "\n"; echo $array [4]= 'd'."\n"; echo $array[]='f'."\n"; //aasocoative array $grosery=['chocolate'=>1, 'sugar'=>10, 'salt'=>3, 'apple'=>2, 'mango'=>5]; // ['1','a','b','c'], this isn't any differnt from the one on the left foreach($array as $key=>$thing) { echo $key . ' ' . $thing. "\n"; } foreach($grosery as $key=>$thing) { //btw, it is spelled grocery echo $key . ' ' . $thing. "\n"; }

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.0040.01116.50
8.3.50.0170.00016.75
8.3.40.0120.00318.79
8.3.30.0070.00718.51
8.3.20.0040.00420.21
8.3.10.0040.00423.61
8.3.00.0040.00421.92
8.2.180.0100.01018.41
8.2.170.0100.00722.96
8.2.160.0110.00319.16
8.2.150.0000.00824.18
8.2.140.0090.00624.66
8.2.130.0080.00021.07
8.2.120.0000.00826.35
8.2.110.0030.00719.25
8.2.100.0120.00018.28
8.2.90.0000.00819.24
8.2.80.0050.00317.97
8.2.70.0040.00417.63
8.2.60.0000.00818.16
8.2.50.0050.00318.10
8.2.40.0040.00420.46
8.2.30.0070.00019.24
8.2.20.0000.00718.07
8.2.10.0040.00418.11
8.2.00.0000.00818.15
8.1.280.0070.00725.92
8.1.270.0030.00522.19
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0060.00319.13
8.1.230.0030.00719.08
8.1.220.0070.00017.77
8.1.210.0030.00518.77
8.1.200.0030.00617.48
8.1.190.0060.00317.35
8.1.180.0000.00718.10
8.1.170.0040.00418.58
8.1.160.0000.00719.03
8.1.150.0000.00720.65
8.1.140.0050.00319.61
8.1.130.0000.00718.82
8.1.120.0050.00217.50
8.1.110.0030.00617.40
8.1.100.0000.00717.43
8.1.90.0000.00717.30
8.1.80.0020.00517.34
8.1.70.0030.00317.41
8.1.60.0060.00417.63
8.1.50.0030.00617.45
8.1.40.0000.00817.51
8.1.30.0030.00617.59
8.1.20.0050.00317.57
8.1.10.0060.00317.59
8.1.00.0000.00817.51
8.0.300.0040.00418.77
8.0.290.0000.00916.75
8.0.280.0050.00218.43
8.0.270.0030.00517.29
8.0.260.0030.00316.72
8.0.250.0000.00716.91
8.0.240.0030.00516.96
8.0.230.0030.00616.93
8.0.220.0040.00416.84
8.0.210.0000.00716.89
8.0.200.0000.00816.83
8.0.190.0040.00416.98
8.0.180.0070.00416.94
8.0.170.0080.00016.79
8.0.160.0030.00316.71
8.0.150.0000.00816.86
8.0.140.0030.00416.75
8.0.130.0030.00313.36
8.0.120.0040.00416.70
8.0.110.0040.00416.75
8.0.100.0050.00216.68
8.0.90.0000.00816.68
8.0.80.0060.01016.92
8.0.70.0040.00416.89
8.0.60.0000.00716.85
8.0.50.0030.00316.88
8.0.30.0090.00716.97
8.0.20.0100.00917.40
8.0.10.0020.00517.02
8.0.00.0110.00716.86
7.4.330.0000.00515.55
7.4.320.0060.00016.59
7.4.300.0000.00616.52
7.4.290.0030.00316.34
7.4.280.0070.00316.46
7.4.270.0000.00716.40
7.4.260.0000.00513.24
7.4.250.0000.00816.40
7.4.240.0040.00416.51
7.4.230.0000.00716.66
7.4.220.0180.00016.56
7.4.210.0110.00416.54
7.4.200.0030.00316.59
7.4.160.0070.00916.51
7.4.150.0090.00917.40
7.4.140.0120.01017.86
7.4.130.0070.01116.50
7.4.120.0090.01016.47
7.4.110.0070.01116.50
7.4.100.0120.00616.62
7.4.90.0140.00716.60
7.4.80.0100.00619.39
7.4.70.0030.01316.71
7.4.60.0090.01216.54
7.4.50.0000.01416.34
7.4.40.0070.01016.51
7.4.30.0160.00316.60
7.4.00.0060.00915.02
7.3.330.0000.00813.23
7.3.320.0050.00013.16
7.3.310.0030.00316.40
7.3.300.0030.00316.23
7.3.290.0080.01016.34
7.3.280.0090.00916.35
7.3.270.0160.00917.40
7.3.260.0110.01016.54
7.3.250.0090.01016.41
7.3.240.0090.01116.50
7.3.230.0080.01216.57
7.3.210.0030.01316.48
7.3.200.0150.00316.36
7.3.190.0070.01016.24
7.3.180.0030.01516.32
7.3.170.0100.00616.37
7.3.160.0150.00316.52
7.2.330.0070.01116.79
7.2.320.0080.00816.52
7.2.310.0110.01116.75
7.2.300.0090.00616.43
7.2.290.0150.00616.50
7.2.60.0090.00316.73
7.2.00.0040.01219.38
7.1.200.0000.01315.55
7.1.100.0050.00518.11
7.1.70.0030.01617.04
7.1.60.0270.01435.03
7.1.50.0270.00934.88
7.1.40.0200.01034.31
7.1.30.0150.01734.63
7.1.20.0160.02234.52
7.1.10.0080.00916.56
7.1.00.0060.01716.71
7.0.200.0080.01116.52
7.0.190.0070.00916.46
7.0.180.0110.00316.20
7.0.170.0000.01716.41
7.0.160.0080.00916.37
7.0.150.0090.00916.32
7.0.140.0120.00316.43
7.0.130.0070.01016.46
7.0.120.0100.00716.60
7.0.110.0030.01416.46
7.0.100.0000.01516.17
7.0.90.0040.01116.38
7.0.80.0040.01116.43
7.0.70.0040.01116.23
7.0.60.0030.01216.20
7.0.50.0030.01416.12
7.0.40.0030.01016.36
7.0.30.0000.01316.64
7.0.20.0070.00716.42
7.0.10.0060.00916.46
7.0.00.0060.00916.33

preferences:
36.55 ms | 401 KiB | 5 Q