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 echo 'Simple arrray: ' . "\n"; foreach($array as $key=>$thing) { echo $key . ' ' . $thing. "\n"; } echo 'Associative array: ' . "\n"; foreach($grosery as $key=>$thing) { //btw, it is spelled grocery echo $key . ' ' . $thing. "\n"; } // now veeeeeerrrrryyy carefuly see the difference and burn it in your mindd!

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.70.0110.01116.58
8.3.60.0110.00716.75
8.3.50.0070.01016.55
8.3.40.0120.00618.76
8.3.30.0090.00618.88
8.3.20.0030.00520.33
8.3.10.0000.00823.68
8.3.00.0040.00421.96
8.2.180.0150.00318.29
8.2.170.0130.00322.96
8.2.160.0110.00419.04
8.2.150.0040.00424.18
8.2.140.0100.00324.66
8.2.130.0080.00021.02
8.2.120.0040.00426.35
8.2.110.0090.00021.18
8.2.100.0060.00618.21
8.2.90.0040.00418.99
8.2.80.0040.00417.97
8.2.70.0040.00417.50
8.2.60.0000.01017.91
8.2.50.0040.00418.16
8.2.40.0030.00620.28
8.2.30.0030.00519.37
8.2.20.0040.00418.11
8.2.10.0030.00518.11
8.2.00.0040.00418.18
8.1.280.0110.00725.92
8.1.270.0040.00423.79
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00523.81
8.1.230.0110.00019.15
8.1.220.0000.00817.80
8.1.210.0050.00418.77
8.1.200.0060.00317.34
8.1.190.0000.00817.23
8.1.180.0080.00018.10
8.1.170.0040.00418.49
8.1.160.0000.00819.02
8.1.150.0000.00720.57
8.1.140.0040.00419.50
8.1.130.0000.00718.89
8.1.120.0000.00717.40
8.1.110.0040.00417.40
8.1.100.0030.00617.49
8.1.90.0000.00717.37
8.1.80.0000.00717.44
8.1.70.0030.00317.48
8.1.60.0060.00317.61
8.1.50.0030.00617.41
8.1.40.0000.00817.55
8.1.30.0000.00917.57
8.1.20.0000.00717.55
8.1.10.0000.01017.55
8.1.00.0030.00617.52
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0040.00418.49
8.0.270.0070.00017.31
8.0.260.0030.00316.88
8.0.250.0000.00616.88
8.0.240.0000.00716.95
8.0.230.0050.00316.98
8.0.220.0070.00016.79
8.0.210.0060.00316.88
8.0.200.0040.00416.99
8.0.190.0030.00516.84
8.0.180.0030.00816.89
8.0.170.0000.00716.80
8.0.160.0040.00416.95
8.0.150.0070.00016.88
8.0.140.0070.00016.85
8.0.130.0050.00013.33
8.0.120.0050.00216.88
8.0.110.0000.00716.85
8.0.100.0040.00416.74
8.0.90.0070.00016.77
8.0.80.0140.00316.88
8.0.70.0040.00416.99
8.0.60.0050.00316.87
8.0.50.0000.00716.92
8.0.30.0090.00816.98
8.0.20.0070.01217.40
8.0.10.0000.00816.83
8.0.00.0100.00716.84
7.4.330.0000.00515.55
7.4.320.0030.00316.40
7.4.300.0030.00316.41
7.4.290.0000.00716.43
7.4.280.0040.00416.62
7.4.270.0000.00816.43
7.4.260.0070.00013.32
7.4.250.0040.00416.59
7.4.240.0000.00716.44
7.4.230.0000.00716.64
7.4.220.0120.00616.44
7.4.210.0060.01416.58
7.4.200.0000.00716.68
7.4.160.0050.01316.55
7.4.150.0060.01117.40
7.4.140.0120.01217.86
7.4.130.0150.00416.56
7.4.120.0130.00616.49
7.4.110.0110.00916.40
7.4.100.0110.00516.40
7.4.90.0060.01216.48
7.4.80.0090.01219.39
7.4.70.0100.00616.43
7.4.60.0110.01116.50
7.4.50.0070.01116.46
7.4.40.0060.01216.48
7.4.30.0060.01716.67
7.4.00.0030.00915.03
7.3.330.0050.00313.18
7.3.320.0000.00613.05
7.3.310.0000.00716.37
7.3.300.0040.00416.36
7.3.290.0080.00916.35
7.3.280.0100.00716.33
7.3.270.0150.00917.40
7.3.260.0100.01116.47
7.3.250.0110.00716.36
7.3.240.0110.00816.60
7.3.230.0130.00516.27
7.3.210.0130.00516.52
7.3.200.0100.01016.49
7.3.190.0180.00316.61
7.3.180.0070.01016.47
7.3.170.0040.01216.27
7.3.160.0110.00716.45
7.2.330.0120.00416.78
7.2.320.0200.00316.55
7.2.310.0060.01516.50
7.2.300.0080.00816.77
7.2.290.0110.00716.70
7.2.60.0060.00616.89
7.2.00.0060.00619.52
7.1.200.0040.00415.73
7.1.100.0040.00418.05
7.1.70.0120.00917.23
7.1.60.0320.01835.12
7.1.50.0390.01534.93
7.1.40.0290.01234.48
7.1.30.0240.01534.63
7.1.20.0210.02134.52
7.1.10.0030.01816.36
7.1.00.0090.01016.71
7.0.200.0120.01216.93
7.0.190.0070.01716.46
7.0.180.0030.01616.20
7.0.170.0090.00616.43
7.0.160.0080.01216.35
7.0.150.0060.01616.23
7.0.140.0040.01116.24
7.0.130.0080.01116.43
7.0.120.0090.01016.45
7.0.110.0080.00816.36
7.0.100.0090.00616.22
7.0.90.0070.01016.29
7.0.80.0090.00616.46
7.0.70.0070.00716.33
7.0.60.0060.01316.15
7.0.50.0080.00616.27
7.0.40.0090.00616.42
7.0.30.0030.01216.54
7.0.20.0080.00916.54
7.0.10.0000.01616.48
7.0.00.0080.00816.18

preferences:
64.91 ms | 401 KiB | 5 Q