3v4l.org

run code in 500+ PHP versions simultaneously
<?php class AATest implements ArrayAccess { protected $array = []; // ArrayAccess interface public function offsetExists(mixed $offset): bool { return key_exists($offset, $this->array); } public function offsetGet(mixed $offset): mixed { return $this->array[$offset]; } public function offsetSet(mixed $offset, mixed $value): void { if( is_null($offset) ) { $this->array[] = $value; } else { $this->array[$offset] = $value; } } public function offsetUnset(mixed $offset): void { unset($this->array[$offset]); } // debug public function dbgGetArray() { return $this->array; } } $object = new AATest(); $object[] = 'a'; $object[NULL] = 'b'; $object[] = 'c'; var_dump($object->dbgGetArray()); $array = []; $array[] = 'a'; $array[NULL] = 'b'; $array[] = 'c'; var_dump($array);

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.90.0110.00616.86
8.5.80.0120.00616.77
8.5.70.0080.01016.91
8.5.60.0100.00817.04
8.5.50.0100.00716.89
8.5.30.0050.00219.47
8.5.20.0090.00820.25
8.5.10.0130.00516.78
8.5.00.0130.01020.30
8.4.240.0130.00919.82
8.4.230.0130.00622.18
8.4.220.0050.00519.65
8.4.210.0120.00921.49
8.4.180.0130.01022.05
8.4.170.0120.00924.02
8.4.160.0120.00924.03
8.4.150.0080.00516.88
8.4.140.0110.00617.77
8.4.130.0120.00217.64
8.4.120.0030.00620.47
8.4.110.0120.00822.56
8.4.100.0110.01017.42
8.4.90.0100.01022.19
8.4.80.0060.00317.96
8.4.70.0060.00219.34
8.4.60.0140.00718.60
8.4.50.0040.00518.62
8.4.40.0090.01018.84
8.4.30.0170.00318.95
8.4.20.0080.00421.43
8.4.10.0080.00019.39
8.3.330.0140.00718.55
8.3.320.0120.00818.60
8.3.310.0110.00918.61
8.3.300.0110.00920.91
8.3.290.0160.00818.62
8.3.280.0140.00618.58
8.3.270.0140.00616.56
8.3.260.0120.00816.66
8.3.250.0050.00318.96
8.3.240.0050.00316.54
8.3.230.0130.00616.83
8.3.220.0130.00517.35
8.3.210.0090.01016.71
8.3.200.0100.01016.57
8.3.190.0100.00917.11
8.3.180.0080.01017.14
8.3.170.0130.00620.98
8.3.160.0060.01217.32
8.3.150.0110.00717.27
8.3.140.0040.01119.25
8.3.130.0040.00418.39
8.3.120.0000.00818.85
8.3.110.0080.00016.61
8.3.100.0090.00016.78
8.3.90.0150.00316.75
8.3.80.0070.00317.97
8.3.70.0150.00418.55
8.3.60.0350.00925.92
8.3.50.0060.00925.92
8.3.40.0250.00625.92
8.3.30.0180.01425.92
8.3.20.0230.01325.92
8.3.10.0230.01225.92
8.3.00.0330.00425.92
8.2.320.0140.00618.08
8.2.310.0140.00618.14
8.2.300.0100.01018.11
8.2.290.0120.00820.48
8.2.280.0080.01120.21
8.2.270.0120.00617.12
8.2.260.0090.00918.67
8.2.250.0130.00717.17
8.2.240.0090.00018.29
8.2.230.0050.00520.94
8.2.220.0060.00324.06
8.2.210.0080.00026.77
8.2.200.0030.00618.16
8.2.190.0120.00616.63
8.2.180.0300.00425.92
8.2.170.0330.00425.92
8.2.160.0320.00825.92
8.2.150.0330.00325.92
8.2.140.0280.00725.92
8.2.130.0280.00725.92
8.2.120.0350.00325.92
8.2.110.0360.00425.92
8.2.100.0410.00025.92
8.2.90.0250.01125.92
8.2.80.0310.00525.92
8.2.70.0200.01325.92
8.2.60.0220.00925.92
8.2.50.0160.01225.92
8.2.40.0240.00425.92
8.2.30.0210.00725.92
8.2.20.0200.00525.92
8.2.10.0170.00925.92
8.2.00.0220.00625.92
8.1.340.0130.00720.01
8.1.330.0120.00717.00
8.1.320.0060.00316.17
8.1.310.0070.00016.94
8.1.300.0090.00918.33
8.1.290.0000.00918.88
8.1.280.0140.00425.92
8.1.270.0100.01625.92
8.1.260.0220.00925.92
8.1.250.0230.00825.92
8.1.240.0240.00625.92
8.1.230.0190.01025.92
8.1.220.0200.00725.92
8.1.210.0250.00725.92
8.1.200.0210.00825.92
8.1.190.0240.00725.92
8.1.180.0190.00625.92
8.1.170.0190.00625.92
8.1.160.0240.00325.92
8.1.150.0320.00025.92
8.1.140.0300.00325.92
8.1.130.0220.00425.92
8.1.120.0180.01125.92
8.1.110.0140.01025.92
8.1.100.0220.00625.92
8.1.90.0120.01225.92
8.1.80.0190.00625.92
8.1.70.0180.01025.92
8.1.60.0240.00625.92
8.1.50.0180.00925.92
8.1.40.0200.00825.92
8.1.30.0240.00725.92
8.1.20.0140.01125.92
8.1.10.0230.00325.92
8.1.00.0210.00525.92

preferences:
42.06 ms | 1050 KiB | 5 Q