3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = ' <content> <hello attribute="123"></hello> </content> '; class Parser { private $xml; public function __construct(SimpleXMLElement $xml) { $this->xml = $xml; } public function asString(): string { return $this->getValue(); } public function asInt(): int { return $this->getValue(); } public function asCastedInt(): int { return $this->asString(); } public function directConversion() { return (int)$this->getValue(); } private function getValue() { return $this->xml->hello['attribute']; } } $object = new Parser(new SimpleXMLElement($xml)); var_dump($object->asString()); var_dump($object->asCastedInt()); var_dump($object->directConversion()); var_dump($object->asInt());

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.0110.00416.88
8.3.50.0120.00918.55
8.3.40.0110.00718.96
8.3.30.0070.00719.13
8.3.20.0040.00420.55
8.3.10.0000.00722.26
8.3.00.0040.00423.88
8.2.180.0150.00418.54
8.2.170.0180.00022.96
8.2.160.0070.01020.55
8.2.150.0040.00724.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0060.00319.39
8.2.110.0000.01121.18
8.2.100.0080.00420.01
8.2.90.0030.00619.95
8.2.80.0080.00018.05
8.2.70.0060.00318.29
8.2.60.0030.00518.28
8.2.50.0050.00318.18
8.2.40.0000.00820.50
8.2.30.0000.00720.66
8.2.20.0000.00818.39
8.2.10.0050.00218.39
8.2.00.0040.00418.59
8.1.280.0110.00425.92
8.1.270.0000.00824.66
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0030.00623.85
8.1.230.0070.00422.95
8.1.220.0000.00917.89
8.1.210.0000.00918.77
8.1.200.0060.00317.60
8.1.190.0000.00817.35
8.1.180.0060.00319.44
8.1.170.0040.00418.75
8.1.160.0000.00819.05
8.1.150.0020.00520.47
8.1.140.0040.00419.64
8.1.130.0030.00319.11
8.1.120.0040.00417.63
8.1.110.0040.00717.50
8.1.100.0080.00017.61
8.1.90.0070.00017.64
8.1.80.0000.00717.61
8.1.70.0030.00317.54
8.1.60.0000.00917.73
8.1.50.0110.00317.65
8.1.40.0050.00317.75
8.1.30.0040.00417.89
8.1.20.0000.00817.76
8.1.10.0000.00717.72
8.1.00.0030.00617.74
8.0.300.0040.00419.91
8.0.290.0030.00616.88
8.0.280.0070.00018.58
8.0.270.0050.00217.36
8.0.260.0030.00317.44
8.0.250.0080.00017.07
8.0.240.0050.00317.24
8.0.230.0000.00717.14
8.0.220.0000.00717.03
8.0.210.0030.00617.03
8.0.200.0000.00617.21
8.0.190.0030.00517.24
8.0.180.0080.00017.02
8.0.170.0000.00817.18
8.0.160.0070.00017.00
8.0.150.0100.00017.14
8.0.140.0000.00717.14
8.0.130.0000.00513.55
8.0.120.0040.00416.89
8.0.110.0040.00417.17
8.0.100.0000.00817.12
8.0.90.0050.00316.97
8.0.80.0030.01817.12
8.0.70.0000.00716.96
8.0.60.0080.00016.98
8.0.50.0030.00617.16
8.0.30.0110.00917.41
8.0.20.0080.01117.41
8.0.10.0000.00817.14
8.0.00.0150.00316.97
7.4.330.0000.00515.55
7.4.320.0030.00316.72
7.4.300.0000.00616.72
7.4.290.0000.00716.68
7.4.280.0030.00616.64
7.4.270.0030.00316.74
7.4.260.0030.00616.88
7.4.250.0070.00016.67
7.4.240.0030.00316.89
7.4.230.0000.00716.74
7.4.220.0040.01416.82
7.4.210.0040.01116.61
7.4.200.0000.00816.88
7.4.160.0090.00916.79
7.4.150.0080.01117.40
7.4.140.0140.01017.86
7.4.130.0070.01216.84
7.4.120.0120.01016.83
7.4.110.0080.01216.91
7.4.100.0050.01316.73
7.4.90.0120.00616.66
7.4.80.0070.01019.39
7.4.70.0090.00916.80
7.4.60.0060.00916.72
7.4.50.0080.00316.76
7.4.40.0120.01016.75
7.4.30.0100.01316.66
7.4.00.0060.01015.04
7.3.330.0060.00013.44
7.3.320.0050.00013.64
7.3.310.0070.00016.44
7.3.300.0070.00016.49
7.3.290.0090.00516.66
7.3.280.0120.00616.63
7.3.270.0030.01417.40
7.3.260.0120.00616.66
7.3.250.0110.00816.60
7.3.240.0050.01416.74
7.3.230.0100.01116.59
7.3.210.0070.01016.66
7.3.200.0170.00516.71
7.3.190.0060.01616.67
7.3.180.0130.00316.75
7.3.170.0090.00616.83
7.3.160.0080.00816.73
7.3.120.0070.01115.04
7.3.110.0030.01014.82
7.3.100.0060.00914.83
7.3.90.0070.00714.80
7.3.80.0030.00915.04
7.3.70.0090.00314.96
7.3.60.0080.00815.03
7.3.50.0110.00315.11
7.3.40.0030.00914.80
7.3.30.0000.00914.95
7.3.20.0040.01116.82
7.3.10.0060.00616.78
7.3.00.0030.01016.63
7.2.330.0150.00316.92
7.2.320.0110.00616.95
7.2.310.0290.02416.96
7.2.300.0060.01216.98
7.2.290.0120.01316.82
7.2.250.0120.00314.77
7.2.240.0030.01715.01
7.2.230.0030.01015.13
7.2.220.0110.00415.37
7.2.210.0100.00715.23
7.2.200.0000.00915.25
7.2.190.0060.00315.32
7.2.180.0000.01815.16
7.2.170.0030.01215.44
7.2.60.0060.00617.11
7.1.330.0040.01115.69
7.1.320.0030.00716.00
7.1.310.0090.00615.88
7.1.300.0090.00915.89
7.1.290.0060.00615.57
7.1.280.0070.00415.95
7.1.270.0060.00615.83
7.1.260.0090.00315.94
7.1.200.0070.00315.83
7.1.70.0040.00417.13
7.1.60.0060.00617.31
7.1.50.0000.01117.13
7.1.40.0040.00816.62
7.1.30.0100.00316.74
7.1.20.0030.00916.74
7.1.10.0090.00916.55
7.1.00.0040.00416.77
7.0.200.0030.00716.99
7.0.190.0050.00316.92
7.0.180.0040.00416.30
7.0.170.0070.00416.35
7.0.160.0030.00516.23
7.0.150.0050.00316.39
7.0.140.0050.00316.41
7.0.130.0000.00716.69
7.0.120.0040.00416.90
7.0.110.0000.01116.44
7.0.100.0000.00816.60
7.0.90.0040.00416.40
7.0.80.0040.00416.69
7.0.70.0040.00416.51
7.0.60.0000.00916.25
7.0.50.0040.00716.34
7.0.40.0030.01015.43
7.0.30.0040.00715.43
7.0.20.0040.01115.43
7.0.10.0030.01215.43
7.0.00.0030.01015.43

preferences:
97.41 ms | 401 KiB | 5 Q