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);

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.0080.00818.15
8.3.50.0100.01021.16
8.3.40.0130.00418.65
8.3.30.0070.00719.02
8.3.20.0040.00420.16
8.3.10.0080.00021.91
8.3.00.0080.00019.68
8.2.180.0040.01116.88
8.2.170.0040.01122.96
8.2.160.0030.01020.27
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0030.00617.88
8.2.110.0100.00019.33
8.2.100.0040.00817.75
8.2.90.0000.00819.19
8.2.80.0090.00017.97
8.2.70.0120.00017.12
8.2.60.0050.00318.04
8.2.50.0040.00418.07
8.2.40.0050.00321.04
8.2.30.0050.00320.63
8.2.20.0000.00817.86
8.2.10.0040.00418.19
8.2.00.0040.00418.04
8.1.280.0190.00625.92
8.1.270.0040.01422.16
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00722.80
8.1.230.0090.00317.66
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0030.00617.13
8.1.190.0040.00417.23
8.1.180.0000.00818.10
8.1.170.0090.00018.25
8.1.160.0050.00222.01
8.1.150.0070.00018.77
8.1.140.0040.00417.50
8.1.130.0000.00717.63
8.1.120.0030.00517.52
8.1.110.0040.00417.52
8.1.100.0040.00417.30
8.1.90.0030.00317.37
8.1.80.0060.00317.49
8.1.70.0050.00217.41
8.1.60.0040.00417.55
8.1.50.0080.00017.42
8.1.40.0060.00617.46
8.1.30.0050.00317.63
8.1.20.0000.00717.59
8.1.10.0040.00417.48
8.1.00.0040.00417.56
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0030.00318.36
8.0.270.0000.00717.14
8.0.260.0030.00317.14
8.0.250.0000.00717.04
8.0.240.0070.00016.99
8.0.230.0000.00716.95
8.0.220.0050.00216.92
8.0.210.0060.00316.96
8.0.200.0000.00617.05
8.0.190.0000.00717.02
8.0.180.0070.00016.94
8.0.170.0080.00016.98
8.0.160.0030.00516.99
8.0.150.0000.00916.88
8.0.140.0000.00816.80
8.0.130.0000.00513.42
8.0.120.0000.00717.00
8.0.110.0000.00716.99
8.0.100.0050.00316.81
8.0.90.0040.00416.99
8.0.80.0130.00616.97
8.0.70.0080.00016.86
8.0.60.0040.00416.94
8.0.50.0040.00417.02
8.0.30.0080.01017.03
8.0.20.0080.01117.40
8.0.10.0000.00716.93
8.0.00.0100.01116.91
7.4.330.0000.00515.09
7.4.320.0050.00316.36
7.4.300.0060.00016.57
7.4.290.0030.00316.55
7.4.280.0030.00816.62
7.4.270.0060.00316.50
7.4.260.0000.00916.46
7.4.250.0000.00816.45
7.4.240.0040.00416.57
7.4.230.0030.00316.41
7.4.220.0090.00916.46
7.4.210.0110.00416.68
7.4.200.0000.00716.41
7.4.160.0090.00916.52
7.4.150.0140.00717.40
7.4.140.0170.00417.86
7.4.130.0130.00616.46
7.4.120.0100.00716.71
7.4.110.0090.00916.45
7.4.100.0120.00616.58
7.4.90.0030.01516.63
7.4.80.0130.00719.39
7.4.70.0180.00316.55
7.4.60.0030.01416.47
7.4.50.0000.00816.62
7.4.40.0180.00716.64
7.4.30.0150.00616.49
7.4.00.0090.00614.97
7.3.330.0030.00313.32
7.3.320.0030.00313.45
7.3.310.0080.00016.46
7.3.300.0070.00016.42
7.3.290.0050.01116.43
7.3.280.0100.00716.42
7.3.270.0070.01017.40
7.3.260.0230.00016.43
7.3.250.0080.00916.41
7.3.240.0080.00916.34
7.3.230.0070.01016.67
7.3.210.0060.01216.67
7.3.200.0040.01316.43
7.3.190.0030.01316.38
7.3.180.0060.01516.71
7.3.170.0100.01416.66
7.3.160.0130.00316.54
7.3.10.0040.01116.31
7.3.00.0030.01316.27
7.2.330.0130.00316.73
7.2.320.0030.01616.72
7.2.310.0160.00416.41
7.2.300.0080.01016.62
7.2.290.0060.01016.40
7.2.130.0130.00016.72
7.2.120.0060.00916.57
7.2.110.0030.00916.52
7.2.100.0040.01116.89
7.2.90.0050.00516.68
7.2.80.0030.01316.59
7.2.70.0000.01516.84
7.2.60.0090.00616.86
7.2.50.0000.01416.93
7.2.40.0060.00916.91
7.2.30.0070.00716.87
7.2.20.0070.00716.96
7.2.10.0030.01016.86
7.2.00.0080.00618.17
7.1.250.0080.00415.58
7.1.200.0030.00915.86
7.1.100.0040.01118.21
7.1.70.0070.00017.07
7.1.60.0190.00919.19
7.1.50.0040.00817.02
7.1.00.0130.05722.43
7.0.200.0080.00016.51
7.0.60.0070.03719.89
7.0.50.0000.05317.91
7.0.40.0100.05720.40
7.0.30.0230.03320.26
7.0.20.0270.07320.24
7.0.10.0070.09020.24
7.0.00.0030.08720.23
5.6.280.0030.05320.78
5.6.210.0100.07720.75
5.6.200.0170.07718.29
5.6.190.0070.05320.61
5.6.180.0030.04320.58
5.6.170.0330.04720.47
5.6.160.0100.08020.46
5.6.150.0000.05018.19
5.6.140.0070.08318.23
5.6.130.0000.05018.16
5.6.120.0070.08321.10
5.6.110.0030.07320.88
5.6.100.0000.08021.04
5.6.90.0170.07320.97
5.6.80.0030.06020.29
5.5.350.0030.07320.35
5.5.340.0100.07318.05
5.5.330.0070.08320.47
5.5.320.0370.06320.31
5.5.310.0200.03720.19
5.5.300.0000.04018.08
5.5.290.0030.08717.95
5.5.280.0270.04720.83
5.5.270.0100.08020.63
5.5.260.0070.06320.76
5.5.250.0170.06320.56
5.5.240.0070.07320.26
5.4.450.0870.07319.59
5.4.440.0800.07019.16
5.4.430.0670.06719.59
5.4.420.0770.06719.44
5.4.410.0830.05719.34
5.4.400.1030.05019.29
5.4.390.0830.04719.06
5.4.380.0800.05319.13
5.4.370.0970.04319.37
5.4.360.0870.06319.23
5.4.350.0800.07018.84
5.4.340.0600.06719.26
5.4.320.0670.05319.28
5.4.310.0730.06019.15
5.4.300.0970.06319.28
5.4.290.1000.05719.05
5.4.280.0870.04719.15
5.4.270.0930.06319.36
5.4.260.0930.07319.36
5.4.250.0900.08019.14
5.4.240.0770.05719.24
5.4.230.0670.06319.00
5.4.220.0900.05018.97
5.4.210.0830.05319.25
5.4.200.0670.05719.25
5.4.190.0600.06319.26
5.4.180.0700.05319.00
5.4.170.0870.05019.29
5.4.160.0770.04719.05
5.4.150.0600.06719.24
5.4.140.0600.05316.57
5.4.130.0630.05316.33
5.4.120.0570.06016.36
5.4.110.0700.07316.63
5.4.100.0770.05016.65
5.4.90.0870.04316.62
5.4.80.0700.05716.49
5.4.70.0030.04316.62
5.4.60.0200.03016.25
5.4.50.0230.03316.33
5.4.40.0300.07016.20
5.4.30.0000.07316.48
5.4.20.0030.07316.55
5.4.10.0200.03316.18

preferences:
45.81 ms | 401 KiB | 5 Q