3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $id; protected $displayName; } class B implements ArrayAccess { protected $id; protected $displayName; public function offsetSet($offset, $value) { $offset = $this->_mapField($offset); $this->$offset = $value; } public function offsetExists($offset) { $offset = $this->_mapField($offset); return isset($this->$offset); } public function offsetUnset($offset) { $offset = $this->_mapField($offset); throw new \Exception("Cannot remove the property $offset"); } public function offsetGet($offset) { $offset = $this->_mapField($offset); if ($this->offsetExists($offset)) { //return $this->$offset; } throw new \Exception("$offset property does not exists"); } private function _mapField($keyFrom) { if ($keyFrom === 'id_user') { return 'id'; } elseif ($keyFrom === 'name') { return 'displayName'; } return $keyFrom; } } $b = new B(); var_dump($b['id']); var_dump($b['id_user']); var_dump($b['displayName']); var_dump($b['name']);

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.0060.01218.68
8.3.50.0050.01322.05
8.3.40.0060.00918.88
8.3.30.0100.01018.85
8.3.20.0070.00020.34
8.3.10.0040.00420.50
8.3.00.0040.00423.48
8.2.180.0090.00916.63
8.2.170.0130.00722.96
8.2.160.0050.00919.46
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0050.00320.84
8.2.120.0050.00326.35
8.2.110.0070.00321.02
8.2.100.0080.00417.91
8.2.90.0060.00318.03
8.2.80.0060.00318.03
8.2.70.0060.00317.75
8.2.60.0040.00417.92
8.2.50.0000.00818.09
8.2.40.0080.00020.53
8.2.30.0000.00719.55
8.2.20.0070.00017.75
8.2.10.0030.00518.21
8.2.00.0040.00418.25
8.1.280.0090.00925.92
8.1.270.0130.00722.19
8.1.260.0040.00428.09
8.1.250.0080.00028.09
8.1.240.0000.00823.92
8.1.230.0110.00021.04
8.1.220.0050.00317.74
8.1.210.0000.00818.95
8.1.200.0100.00017.48
8.1.190.0060.00317.23
8.1.180.0090.00018.10
8.1.170.0030.00818.53
8.1.160.0040.00420.78
8.1.150.0040.00420.64
8.1.140.0030.00519.47
8.1.130.0000.00717.73
8.1.120.0050.00217.38
8.1.110.0000.00717.30
8.1.100.0020.00517.51
8.1.90.0040.00417.35
8.1.80.0040.00417.39
8.1.70.0080.00017.43
8.1.60.0000.00817.59
8.1.50.0000.00917.42
8.1.40.0000.00817.46
8.1.30.0060.00317.70
8.1.20.0050.00317.48
8.1.10.0000.00817.64
8.1.00.0000.00817.42
8.0.300.0000.00720.03
8.0.290.0040.00416.75
8.0.280.0070.00018.57
8.0.270.0000.00717.28
8.0.260.0040.00417.27
8.0.250.0000.00717.02
8.0.240.0030.00316.96
8.0.230.0070.00016.95
8.0.220.0000.00817.00
8.0.210.0060.00316.86
8.0.200.0000.00817.01
8.0.190.0040.00417.04
8.0.180.0000.00716.97
8.0.170.0030.00517.04
8.0.160.0000.00717.04
8.0.150.0040.00416.92
8.0.140.0040.00416.93
8.0.130.0000.00513.44
8.0.120.0080.00016.97
8.0.110.0000.00817.00
8.0.100.0040.00416.75
8.0.90.0070.00016.80
8.0.80.0120.00616.95
8.0.70.0050.00316.84
8.0.60.0040.00416.77
8.0.50.0040.00416.80
8.0.30.0100.00817.26
8.0.20.0070.01217.40
8.0.10.0080.00016.95
8.0.00.0100.00816.91
7.4.330.0050.00016.71
7.4.320.0070.00016.59
7.4.300.0030.00316.42
7.4.290.0080.00016.62
7.4.280.0000.00716.46
7.4.270.0070.00016.54
7.4.260.0000.00716.64
7.4.250.0040.00416.47
7.4.240.0000.00816.45
7.4.230.0070.00316.61
7.4.220.0030.01416.73
7.4.210.0080.00816.54
7.4.200.0040.00416.53
7.4.160.0000.01616.82
7.4.150.0180.00017.40
7.4.140.0070.01017.86
7.4.130.0130.00916.54
7.4.120.0070.01016.52
7.4.110.0070.01016.42
7.4.100.0120.00916.57
7.4.90.0080.00816.50
7.4.80.0130.01019.39
7.4.70.0090.00616.44
7.4.60.0090.00916.47
7.4.50.0070.01116.64
7.4.40.0110.01116.45
7.4.30.0090.00916.74
7.4.00.0060.00615.06
7.3.330.0000.00513.21
7.3.320.0030.00313.31
7.3.310.0040.00416.50
7.3.300.0000.00716.32
7.3.290.0000.00716.40
7.3.280.0080.00816.42
7.3.270.0090.00917.40
7.3.260.0170.00616.59
7.3.250.0100.00816.39
7.3.240.0040.01416.55
7.3.230.0070.01116.55
7.3.210.0110.00816.66
7.3.200.0090.01216.46
7.3.190.0060.01216.60
7.3.180.0140.00716.57
7.3.170.0070.01016.48
7.3.160.0080.00816.64
7.2.330.0080.01216.56
7.2.320.0040.01416.87
7.2.310.0030.01316.74
7.2.300.0150.00016.59
7.2.290.0080.00816.51
7.2.60.0030.01017.21
7.2.00.0060.01219.22
7.1.200.0000.00815.75
7.1.100.0040.00818.38
7.1.70.0000.01117.23
7.1.60.0060.00919.40
7.1.50.0060.01617.11
7.1.00.0070.07022.44
7.0.200.0400.01114.49
7.0.60.0300.06019.96
7.0.50.0130.07317.79
7.0.40.0070.09020.13
7.0.30.0200.04320.07
7.0.20.0330.06720.22
7.0.10.0100.07020.27
7.0.00.0000.09020.23
5.6.280.0030.06720.94
5.6.210.0100.04020.75
5.6.200.0070.05018.12
5.6.190.0100.04720.64
5.6.180.0370.07020.46
5.6.170.0230.04720.62
5.6.160.0100.04320.50
5.6.150.0030.07718.28
5.6.140.0130.06718.28
5.6.130.0000.05318.17
5.6.120.0030.04321.00
5.6.110.0070.04321.14
5.6.100.0100.06020.98
5.6.90.0170.07320.99
5.6.80.0100.07720.38
5.5.350.0000.03320.35
5.5.340.0100.03717.96
5.5.330.0030.04020.35
5.5.320.0530.06020.30
5.5.310.0300.06320.27
5.5.300.0100.05017.98
5.5.290.0000.04317.97
5.5.280.0000.04720.81
5.5.270.0200.07020.80
5.5.260.0070.08020.80
5.5.250.0100.06320.57
5.5.240.0000.08320.37

preferences:
50.15 ms | 401 KiB | 5 Q