3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Obj implements ArrayAccess { private $container = array(); public function __construct() { $this->container = array( "one" => 1, "two" => 2, "three" => 3, ); } public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } public function offsetExists($offset): bool { return isset($this->container[$offset]); } public function offsetUnset($offset): void { unset($this->container[$offset]); } public function offsetGet($offset): mixed { return isset($this->container[$offset]) ? $this->container[$offset] : null; } } $obj = new Obj; $obj[] = 3; $obj[] = 4; print_r($obj);

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.5.30.0130.00619.63
8.5.20.0100.00720.13
8.5.10.0080.00919.92
8.5.00.0110.01020.04
8.4.180.0120.01019.58
8.4.170.0130.01020.65
8.4.160.0130.00723.86
8.4.150.0030.00014.05
8.4.140.0130.00817.66
8.4.130.0130.00717.58
8.4.120.0040.00524.11
8.4.110.0060.00418.77
8.4.100.0100.01017.75
8.4.90.0100.00720.50
8.4.80.0050.00420.64
8.4.70.0040.00518.81
8.4.60.0150.00420.41
8.4.50.0060.00818.54
8.4.40.0060.00319.64
8.4.30.0130.00718.53
8.4.20.0170.00317.82
8.4.10.0060.01323.96
8.3.300.0080.01320.82
8.3.290.0120.00820.82
8.3.280.0150.00518.29
8.3.270.0090.01016.58
8.3.260.0080.01116.33
8.3.250.0070.00119.09
8.3.240.0110.00817.29
8.3.230.0120.00717.02
8.3.220.0030.00618.93
8.3.210.0120.01016.52
8.3.200.0060.00316.64
8.3.190.0090.00617.21
8.3.180.0050.00318.91
8.3.170.0160.00416.98
8.3.160.0150.00316.51
8.3.150.0150.00417.21
8.3.140.0040.00416.45
8.3.130.0130.00716.70
8.3.120.0100.00619.13
8.3.110.0110.00720.94
8.3.100.0000.00824.06
8.3.90.0030.00626.77
8.3.80.0060.00317.97
8.3.70.0090.00616.75
8.3.60.0170.00316.50
8.3.50.0180.00416.85
8.3.40.0130.01021.98
8.3.30.0030.01518.67
8.3.20.0030.00524.18
8.3.10.0000.00824.66
8.3.00.0040.00426.16
8.2.300.0110.00922.05
8.2.290.0110.00817.13
8.2.280.0100.01118.54
8.2.270.0090.00616.57
8.2.260.0040.00417.17
8.2.250.0080.00316.71
8.2.240.0120.00617.29
8.2.230.0030.00622.58
8.2.220.0110.00737.54
8.2.210.0110.00726.77
8.2.200.0030.00716.75
8.2.190.0080.00816.63
8.2.180.0060.01216.75
8.2.170.0040.01522.96
8.2.160.0100.01022.96
8.2.150.0040.00425.66
8.2.140.0090.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00421.19
8.2.110.0060.00322.16
8.2.100.0090.00317.78
8.2.90.0030.00617.63
8.2.80.0040.00418.86
8.2.70.0050.00318.05
8.2.60.0030.00617.50
8.2.50.0040.00417.63
8.2.40.0140.00719.05
8.2.30.0120.00617.72
8.2.20.0040.01217.72
8.2.10.0090.00917.72
8.2.00.0160.00319.17
8.1.340.0070.00421.69
8.1.330.0110.00819.82
8.1.320.0090.01116.15
8.1.310.0110.00716.54
8.1.300.0160.00016.21
8.1.290.0030.00618.88
8.1.280.0070.00725.92
8.1.270.0040.00424.66
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0060.00323.84
8.1.230.0040.00819.18
8.1.220.0050.00317.79
8.1.210.0030.00518.77
8.1.200.0030.00517.35
8.1.190.0000.00817.35
8.1.180.0000.00818.10
8.1.170.0160.00517.72
8.1.160.0100.01017.72
8.1.150.0160.00317.72
8.1.140.0130.00717.72
8.1.130.0180.00017.72
8.1.120.0150.00317.72
8.1.110.0060.01317.72
8.1.100.0130.00717.72
8.1.90.0130.00317.72
8.1.80.0060.01117.72
8.1.70.0120.00617.72
8.1.60.0200.00017.72
8.1.50.0210.00317.72
8.1.40.0130.00617.72
8.1.30.0140.00617.72
8.1.20.0110.00817.72
8.1.10.0130.00817.72
8.1.00.0060.01217.72
8.0.300.0030.00518.77
8.0.290.0000.00716.75
8.0.280.0130.00417.72
8.0.270.0200.00017.72
8.0.260.0170.00317.72
8.0.250.0130.00618.01
8.0.240.0180.00018.25
8.0.230.0140.00317.72
8.0.220.0150.00317.72
8.0.210.0180.00017.72
8.0.200.0110.00717.72
8.0.190.0140.00517.72
8.0.180.0040.01217.72
8.0.170.0150.00317.72
8.0.160.0110.00517.72
8.0.150.0110.00717.72
8.0.140.0170.00317.72
8.0.130.0130.00517.72
8.0.120.0170.00317.72
8.0.110.0080.00917.72
8.0.100.0170.00017.72
8.0.90.0140.00417.72
8.0.80.0140.00417.72
8.0.70.0150.00217.72
8.0.60.0140.00417.72
8.0.50.0200.00017.72
8.0.30.0160.00317.72
8.0.20.0190.00017.72
8.0.10.0100.00717.72

preferences:
33.39 ms | 403 KiB | 5 Q