3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test_val_as_array($val) { $type = gettype($val); try { echo "val before access = ".var_export($val, true)."\n"; echo "accessing $type as array {$val['test']}\n"; $val['test'] = 'wtf'; echo "set $type offset 'test' to string 'wtf'\n"; echo "$type offset 'test' = {$val['test']}\n"; echo "val after access = ".var_export($val, true)."\n"; } catch (Exception $e) { echo "caught error {$e->getMessage()} when accessing $type as array\n"; } }; test_val_as_array(null); test_val_as_array('test'); test_val_as_array(123); test_val_as_array(true); test_val_as_array(1.2); test_val_as_array(new stdClass);

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.0110.00718.31
8.3.50.0100.01316.69
8.3.40.0150.00018.96
8.3.30.0120.00319.02
8.3.20.0070.00020.34
8.3.10.0070.00021.78
8.3.00.0000.00819.79
8.2.180.0140.01016.75
8.2.170.0090.00622.96
8.2.160.0110.00420.39
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0050.00317.75
8.2.110.0070.00320.35
8.2.100.0140.00017.75
8.2.90.0050.00319.34
8.2.80.0000.00817.97
8.2.70.0050.00517.50
8.2.60.0030.00717.77
8.2.50.0080.00018.07
8.2.40.0050.00521.19
8.2.30.0040.00420.68
8.2.20.0050.00317.73
8.2.10.0070.00018.13
8.2.00.0040.00418.04
8.1.280.0070.01425.92
8.1.270.0090.00921.96
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00020.96
8.1.230.0040.00717.77
8.1.220.0000.00817.79
8.1.210.0030.00518.77
8.1.200.0040.00417.25
8.1.190.0040.00417.35
8.1.180.0080.00018.10
8.1.170.0030.00618.62
8.1.160.0050.00222.03
8.1.150.0070.00018.91
8.1.140.0080.00017.50
8.1.130.0000.00717.70
8.1.120.0040.00317.39
8.1.110.0030.00517.38
8.1.100.0040.00417.36
8.1.90.0040.00417.53
8.1.80.0050.00517.36
8.1.70.0070.00017.37
8.1.60.0040.00417.59
8.1.50.0020.00517.39
8.1.40.0030.00617.43
8.1.30.0040.00417.69
8.1.20.0040.00417.60
8.1.10.0080.00017.60
8.1.00.0080.00017.48
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0070.00018.37
8.0.270.0000.00717.18
8.0.260.0000.00617.29
8.0.250.0070.00016.97
8.0.240.0080.00017.01
8.0.230.0000.00916.89
8.0.220.0050.00217.00
8.0.210.0000.00817.03
8.0.200.0040.00417.05
8.0.190.0000.00717.09
8.0.180.0080.00317.00
8.0.170.0050.00316.99
8.0.160.0040.00416.87
8.0.150.0000.00716.78
8.0.140.0050.00316.91
8.0.130.0030.00313.43
8.0.120.0060.00316.96
8.0.110.0030.00616.97
8.0.100.0000.00817.03
8.0.90.0030.00316.84
8.0.80.0090.00616.92
8.0.70.0030.00516.92
8.0.60.0050.00316.95
8.0.50.0000.00816.90
8.0.30.0080.01217.20
8.0.20.0090.01317.40
8.0.10.0040.00417.11
8.0.00.0110.01216.65
7.4.330.0000.00515.20
7.4.320.0030.00316.45
7.4.300.0000.00716.53
7.4.290.0000.00716.43
7.4.280.0080.00316.40
7.4.270.0070.00416.59
7.4.260.0070.00316.52
7.4.250.0040.00416.60
7.4.240.0050.00316.57
7.4.230.0070.00016.46
7.4.220.0060.00916.46
7.4.210.0070.00716.64
7.4.200.0030.00316.27
7.4.160.0090.00616.53
7.4.150.0090.00917.40
7.4.140.0090.01217.86
7.4.130.0100.00816.74
7.4.120.0070.01216.60
7.4.110.0090.00916.30
7.4.100.0150.00316.56
7.4.90.0090.00916.66
7.4.80.0080.00919.39
7.4.70.0170.00016.41
7.4.60.0060.01116.53
7.4.50.0000.00816.55
7.4.40.0110.00716.63
7.4.30.0070.01116.58
7.4.00.0070.01014.96
7.3.330.0000.00713.41
7.3.320.0030.00313.50
7.3.310.0040.00416.45
7.3.300.0060.00016.45
7.3.290.0100.00816.47
7.3.280.0070.01116.41
7.3.270.0040.01517.40
7.3.260.0130.01316.42
7.3.250.0090.01016.55
7.3.240.0070.01016.56
7.3.230.0160.00016.57
7.3.210.0120.00616.60
7.3.200.0070.00716.39
7.3.190.0070.01116.37
7.3.180.0060.00916.48
7.3.170.0040.01916.44
7.3.160.0060.01216.41
7.2.330.0110.01116.45
7.2.320.0100.01316.43
7.2.310.0100.01316.77
7.2.300.0090.00916.35
7.2.290.0090.00616.54
7.2.60.0090.00616.83
7.2.00.0040.01219.46
7.1.200.0060.00915.88
7.1.100.0000.00918.36
7.1.70.0050.00517.27
7.1.60.0180.01219.19
7.1.50.0110.01116.90
7.1.00.0000.08022.33
7.0.200.0050.00516.68
7.0.60.0070.07719.97
7.0.50.0100.03318.01
7.0.40.0070.04320.30
7.0.30.0270.03720.34
7.0.20.0330.04320.15
7.0.10.0170.05720.22
7.0.00.0070.07020.09
5.6.280.0070.06721.04
5.6.210.0130.06320.50
5.6.200.0100.03718.19
5.6.190.0100.06320.34
5.6.180.0170.07020.55
5.6.170.0300.07320.48
5.6.160.0070.04020.45
5.6.150.0170.07018.18
5.6.140.0030.04318.18
5.6.130.0070.07318.23
5.6.120.0130.06020.98
5.6.110.0100.07321.10
5.6.100.0100.03721.09
5.6.90.0030.08020.98
5.6.80.0130.07020.51
5.5.350.0030.07020.41
5.5.340.0070.08717.98
5.5.330.0070.04020.32
5.5.320.0270.06720.33
5.5.310.0200.04320.41
5.5.300.0030.08717.98
5.5.290.0100.08017.95
5.5.280.0030.07320.89
5.5.270.0130.06320.77
5.5.260.0170.07320.68
5.5.250.0130.04020.50
5.5.240.0000.07720.37
5.4.450.0700.06019.48
5.4.440.0600.06319.57
5.4.430.0570.06319.47
5.4.420.0570.06319.30
5.4.410.0670.07019.16
5.4.400.0670.06019.30
5.4.390.0770.07319.28
5.4.380.0870.06719.26
5.4.370.0670.05719.16
5.4.360.0800.08019.06
5.4.350.0830.07319.15
5.4.340.0870.07319.14
5.4.320.0670.07018.88
5.4.310.0800.07719.22
5.4.300.0800.07019.07
5.4.290.0730.06319.03
5.4.280.0600.07719.25
5.4.270.0630.06019.15
5.4.260.0800.05719.27
5.4.250.0730.06719.12
5.4.240.0670.06319.00
5.4.230.0730.07719.15
5.4.220.0770.05719.28
5.4.210.0570.06019.20
5.4.200.0630.06019.14
5.4.190.0700.07019.11
5.4.180.0830.06719.05
5.4.170.0800.05718.83
5.4.160.0770.06719.23
5.4.150.0930.07719.27
5.4.140.0700.06316.43
5.4.130.0500.06316.30
5.4.120.0600.05716.36
5.4.110.0670.06016.64
5.4.100.0670.06716.67
5.4.90.0630.05016.35
5.4.80.0800.05016.57
5.4.70.0070.06016.57
5.4.60.0200.03316.49
5.4.50.0200.03716.34
5.4.40.0170.03716.38
5.4.30.0030.05316.16
5.4.20.0000.07716.56
5.4.10.0270.07716.16

preferences:
41.68 ms | 400 KiB | 5 Q