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.0090.01218.52
8.3.50.0110.00722.05
8.3.40.0120.00318.98
8.3.30.0130.00318.67
8.3.20.0000.00720.28
8.3.10.0040.00420.48
8.3.00.0080.00023.39
8.2.180.0090.00616.50
8.2.170.0120.00322.96
8.2.160.0100.00722.16
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00020.88
8.2.120.0080.00026.35
8.2.110.0090.00020.93
8.2.100.0090.00317.91
8.2.90.0000.00819.36
8.2.80.0080.00017.97
8.2.70.0030.00617.75
8.2.60.0060.00318.04
8.2.50.0000.00918.10
8.2.40.0080.00020.35
8.2.30.0040.00419.39
8.2.20.0050.00217.90
8.2.10.0000.00718.11
8.2.00.0080.00018.21
8.1.280.0130.00325.92
8.1.270.0080.00023.99
8.1.260.0060.00328.09
8.1.250.0040.00428.09
8.1.240.0070.00324.00
8.1.230.0120.00019.67
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0090.00317.38
8.1.190.0080.00017.22
8.1.180.0040.00418.10
8.1.170.0030.00518.52
8.1.160.0040.00420.83
8.1.150.0050.00320.68
8.1.140.0040.00419.51
8.1.130.0000.00717.61
8.1.120.0000.00817.43
8.1.110.0040.00417.48
8.1.100.0070.00017.43
8.1.90.0000.00817.37
8.1.80.0040.00417.45
8.1.70.0030.00517.52
8.1.60.0000.00917.54
8.1.50.0000.00817.58
8.1.40.0040.00417.43
8.1.30.0040.00417.69
8.1.20.0040.00417.36
8.1.10.0000.00717.60
8.1.00.0000.00717.52
8.0.300.0060.00318.77
8.0.290.0030.00616.63
8.0.280.0080.00018.52
8.0.270.0070.00017.27
8.0.260.0030.00317.28
8.0.250.0000.00717.15
8.0.240.0030.00317.04
8.0.230.0030.00317.01
8.0.220.0000.00816.92
8.0.210.0050.00316.92
8.0.200.0000.00717.06
8.0.190.0040.00416.95
8.0.180.0000.00817.00
8.0.170.0000.00816.99
8.0.160.0000.00716.88
8.0.150.0040.00416.81
8.0.140.0000.00816.90
8.0.130.0000.00513.47
8.0.120.0080.00016.93
8.0.110.0040.00417.05
8.0.100.0000.00716.82
8.0.90.0000.00717.03
8.0.80.0070.01417.00
8.0.70.0070.00017.00
8.0.60.0060.00317.02
8.0.50.0040.00416.83
8.0.30.0130.00717.17
8.0.20.0130.00817.40
8.0.10.0040.00416.97
8.0.00.0090.01016.81
7.4.330.0030.00316.74
7.4.320.0030.00316.55
7.4.300.0000.00716.43
7.4.290.0000.00716.50
7.4.280.0060.00316.65
7.4.270.0030.00316.52
7.4.260.0040.00416.54
7.4.250.0050.00316.46
7.4.240.0000.00816.63
7.4.230.0030.00316.38
7.4.220.0070.01316.65
7.4.210.0070.00716.69
7.4.200.0000.00816.61
7.4.160.0150.00316.56
7.4.150.0100.00717.40
7.4.140.0100.01017.86
7.4.130.0120.00616.58
7.4.120.0070.01316.68
7.4.110.0060.01316.51
7.4.100.0120.00916.58
7.4.90.0070.01016.61
7.4.80.0120.00619.39
7.4.70.0090.01216.43
7.4.60.0130.00316.34
7.4.50.0030.01016.41
7.4.40.0130.00316.67
7.4.30.0100.00716.45
7.4.00.0040.01214.89
7.3.330.0050.00013.45
7.3.320.0030.00313.24
7.3.310.0030.00316.48
7.3.300.0000.00716.42
7.3.290.0030.00516.47
7.3.280.0030.01216.44
7.3.270.0040.01417.40
7.3.260.0070.01116.43
7.3.250.0080.00916.44
7.3.240.0130.00916.57
7.3.230.0110.00716.57
7.3.210.0060.01616.46
7.3.200.0040.01716.68
7.3.190.0090.00916.43
7.3.180.0100.00716.40
7.3.170.0120.00916.69
7.3.160.0060.00916.61
7.3.10.0070.00716.70
7.3.00.0060.00616.77
7.2.330.0040.01916.89
7.2.320.0030.01516.68
7.2.310.0110.00716.81
7.2.300.0070.01016.58
7.2.290.0090.00916.70
7.2.130.0070.01017.06
7.2.120.0110.00817.00
7.2.110.0080.01116.73
7.2.100.0130.00716.97
7.2.90.0110.00616.78
7.2.80.0110.00416.88
7.2.70.0060.00616.79
7.2.60.0060.00916.90
7.2.50.0070.00716.80
7.2.40.0080.00616.88
7.2.30.0060.00916.66
7.2.20.0070.00717.05
7.2.10.0060.00917.13
7.2.00.0090.00318.25
7.1.250.0030.00615.90
7.1.200.0080.00815.79
7.1.100.0030.01018.30
7.1.70.0000.00817.26
7.1.60.0120.01219.40
7.1.50.0060.00616.95
7.1.00.0030.07722.54
7.0.200.0520.00314.64
7.0.60.0400.05721.87
7.0.50.0070.08317.89
7.0.40.0170.08319.96
7.0.30.0230.04020.06
7.0.20.0230.06020.15
7.0.10.0030.08720.06
7.0.00.0100.06720.26
5.6.280.0000.03321.16
5.6.210.0100.06320.78
5.6.200.0030.09018.25
5.6.190.0070.07020.50
5.6.180.0270.07020.46
5.6.170.0270.07020.54
5.6.160.0100.07320.61
5.6.150.0070.06018.13
5.6.140.0100.07318.16
5.6.130.0070.06718.17
5.6.120.0000.04321.00
5.6.110.0130.03321.02
5.6.100.0030.07721.14
5.6.90.0030.04720.98
5.6.80.0100.07320.41
5.5.350.4130.05020.36
5.5.340.0030.03718.08
5.5.330.0030.04320.21
5.5.320.0370.04020.35
5.5.310.0230.06320.30
5.5.300.0070.06317.98
5.5.290.0100.03317.96
5.5.280.0070.09020.89
5.5.270.0030.09020.88
5.5.260.0070.09020.86
5.5.250.0030.04320.59
5.5.240.0270.07720.17

preferences:
38.48 ms | 401 KiB | 5 Q