3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test implements Countable { public $prop1; private $propa=2; protected $propx=3; public $prop4 = array(1,2,3,4); public function Greet() { return 'hello world'; } public function getCount() { $res = (array) $this; return count($res); } public function count() { return $this->getCount(); } } $t = new Test; echo $t->Greet(),"\n"; echo count( (array) $t),"\n"; echo $t->getCount(),"\n"; echo count($t),"\n"; var_dump( get_object_vars($t) ); $a = (array) $t; echo count($ao = new ArrayObject($a)),"\n"; echo $ao->count();

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.0040.01416.75
8.3.50.0140.00622.11
8.3.40.0070.00718.79
8.3.30.0140.00019.10
8.3.20.0040.00420.16
8.3.10.0040.00423.69
8.3.00.0110.00017.50
8.2.180.0040.01118.41
8.2.170.0100.00722.96
8.2.160.0030.01020.27
8.2.150.0070.00024.18
8.2.140.0060.00324.66
8.2.130.0050.00326.16
8.2.120.0070.00022.13
8.2.110.0060.00322.20
8.2.100.0000.01217.72
8.2.90.0030.00519.14
8.2.80.0040.00417.97
8.2.70.0060.00317.63
8.2.60.0030.00618.03
8.2.50.0000.00918.07
8.2.40.0040.00418.22
8.2.30.0070.00018.13
8.2.20.0000.00817.70
8.2.10.0000.00717.97
8.2.00.0000.01017.61
8.1.280.0140.01125.92
8.1.270.0070.00022.19
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0090.00023.96
8.1.230.0060.00619.07
8.1.220.0030.00617.74
8.1.210.0050.00318.77
8.1.200.0000.00917.35
8.1.190.0040.00417.64
8.1.180.0030.00618.10
8.1.170.0030.00518.65
8.1.160.0040.00421.91
8.1.150.0000.00718.67
8.1.140.0000.00817.39
8.1.130.0000.00717.84
8.1.120.0040.00417.51
8.1.110.0030.00517.44
8.1.100.0000.00717.51
8.1.90.0000.00717.46
8.1.80.0030.00617.48
8.1.70.0040.00417.44
8.1.60.0060.00317.61
8.1.50.0040.00417.44
8.1.40.0040.00417.55
8.1.30.0090.00017.62
8.1.20.0080.00017.58
8.1.10.0030.00617.57
8.1.00.0000.00817.52
8.0.300.0040.00418.77
8.0.290.0040.00417.16
8.0.280.0070.00018.46
8.0.270.0040.00417.38
8.0.260.0030.00317.29
8.0.250.0040.00417.04
8.0.240.0030.00517.01
8.0.230.0050.00216.97
8.0.220.0070.00016.92
8.0.210.0040.00416.90
8.0.200.0070.00016.99
8.0.190.0040.00416.98
8.0.180.0040.00416.95
8.0.170.0050.00317.03
8.0.160.0000.00716.97
8.0.150.0000.00716.91
8.0.140.0040.00416.77
8.0.130.0000.00813.38
8.0.120.0030.00616.86
8.0.110.0030.00616.82
8.0.100.0050.00316.85
8.0.90.0000.00816.80
8.0.80.0120.00916.96
8.0.70.0000.00716.80
8.0.60.0000.00716.80
8.0.50.0040.00416.80
8.0.30.0130.00917.19
8.0.20.0030.01517.40
8.0.10.0040.00417.13
8.0.00.0100.00816.78
7.4.330.0000.00515.05
7.4.320.0000.00716.63
7.4.300.0000.00716.52
7.4.290.0070.00016.51
7.4.280.0060.00316.52
7.4.270.0000.00716.55
7.4.260.0030.00316.40
7.4.250.0040.00416.50
7.4.240.0040.00316.58
7.4.230.0000.00616.41
7.4.220.0070.01016.71
7.4.210.0080.00816.60
7.4.200.0000.00816.52
7.4.190.0040.00416.66
7.4.160.0130.00316.53
7.4.150.0160.00417.40
7.4.140.0140.00617.86
7.4.130.0080.00816.66
7.4.120.0150.00216.51
7.4.110.0080.01516.40
7.4.100.0130.00616.46
7.4.90.0030.01316.65
7.4.80.0030.01519.39
7.4.70.0050.01016.58
7.4.60.0090.00916.44
7.4.50.0030.00616.43
7.4.40.0060.00922.77
7.4.30.0120.00416.56
7.4.00.0030.01215.10
7.3.330.0000.00513.20
7.3.320.0030.00313.26
7.3.310.0040.00416.29
7.3.300.0030.00516.34
7.3.290.0110.00416.30
7.3.280.0070.00816.31
7.3.270.0030.01517.40
7.3.260.0070.01116.56
7.3.250.0120.00916.25
7.3.240.0090.00616.32
7.3.230.0060.00916.39
7.3.210.0060.01216.61
7.3.200.0030.01719.39
7.3.190.0060.01416.33
7.3.180.0100.00616.45
7.3.170.0060.01016.52
7.3.160.0110.00516.59
7.3.120.0030.01014.80
7.3.10.0100.01116.48
7.3.00.0060.01016.29
7.2.330.0130.00516.81
7.2.320.0110.00716.70
7.2.310.0090.00916.70
7.2.300.0060.01216.59
7.2.290.0180.00016.68
7.2.130.0060.00816.78
7.2.120.0080.01216.70
7.2.110.0130.00716.43
7.2.100.0050.01216.60
7.2.90.0070.01216.48
7.2.80.0090.00916.65
7.2.70.0100.00816.64
7.2.60.0050.00716.81
7.2.50.0060.00916.66
7.2.40.0030.01316.65
7.2.30.0080.01216.73
7.2.20.0160.00616.55
7.2.10.0100.00616.53
7.2.00.0070.00816.61
7.1.250.0120.00715.39
7.1.200.0030.00915.57
7.1.70.0030.00517.00
7.1.60.0120.01219.33
7.1.50.0070.01416.79
7.1.00.0000.08022.32
7.0.200.0000.01416.79
7.0.140.0030.07021.90
7.0.60.0000.04319.95
7.0.50.0100.03717.88
7.0.40.0000.04719.96
7.0.30.0400.04720.17
7.0.20.0170.04020.09
7.0.10.0070.08020.33
7.0.00.0100.08320.24
5.6.280.0070.08720.82
5.6.210.0070.03720.50
5.6.200.0130.05018.29
5.6.190.0070.09020.34
5.6.180.0230.07020.47
5.6.170.0230.04320.50
5.6.160.0100.08020.48
5.6.150.0100.06718.18
5.6.140.0030.04718.18
5.6.130.0000.09018.17
5.6.120.0070.05321.13
5.6.110.0000.07321.05
5.6.100.0100.08020.94
5.6.90.0100.07320.98
5.6.80.0070.07320.36
5.6.70.4470.03720.53
5.5.350.0170.08320.42
5.5.340.0030.04018.05
5.5.330.0100.08020.36
5.5.320.0070.05320.34
5.5.310.0330.05020.30
5.5.300.0030.08318.08
5.5.290.0100.04717.98
5.5.280.0000.04720.77
5.5.270.0130.07720.80
5.5.260.0230.06720.98
5.5.250.0230.07320.48
5.5.240.0230.07020.36
5.4.450.0200.06719.30
5.4.440.0800.05319.19
5.4.430.0530.06019.30
5.4.420.0100.06019.62
5.4.410.1200.07019.19
5.4.400.0870.05719.31
5.4.390.0700.06019.13
5.4.380.0470.04318.63
5.4.370.0270.05318.76
5.4.360.0230.06018.86
5.4.350.0330.07018.58
5.4.340.0230.05718.71
5.4.320.0070.03912.50
5.4.310.0070.03812.50
5.4.300.0070.03512.51
5.4.290.0080.03812.50
5.4.280.0170.07112.37
5.4.270.0420.05212.37
5.4.260.0330.10612.38
5.4.250.0610.17912.37
5.4.240.0210.06412.37
5.4.230.0260.06512.36
5.4.220.0180.09212.36
5.4.210.0330.12512.36
5.4.200.0200.16012.37
5.4.190.0190.10612.36
5.4.180.0190.10912.36
5.4.170.0140.07512.37
5.4.160.0150.06812.36
5.4.150.0180.07112.36
5.4.140.0150.06712.04
5.4.130.0340.03912.03
5.4.120.0180.05212.00
5.4.110.0180.08411.98
5.4.100.0200.06511.99
5.4.90.0050.06211.99
5.4.80.0100.05411.99
5.4.70.0080.05911.98
5.4.60.0130.04111.98
5.4.50.0070.04611.99
5.4.40.0070.04811.98
5.4.30.0090.04411.97
5.4.20.0100.05111.97
5.4.10.0140.11711.97
5.4.00.0150.08411.46
5.3.290.0060.04012.80
5.3.280.0140.07012.71
5.3.270.0170.07312.72
5.3.260.0260.09412.71
5.3.250.0190.05412.72
5.3.240.0180.06212.72
5.3.230.0090.06612.71
5.3.220.0130.06112.68
5.3.210.0250.08812.68
5.3.200.0070.05912.68
5.3.190.0150.05012.68
5.3.180.0130.05912.67
5.3.170.0130.08412.67
5.3.160.0160.09312.67
5.3.150.0160.05912.68
5.3.140.0140.10412.66
5.3.130.0130.07412.66
5.3.120.0210.09512.66
5.3.110.0100.05512.66
5.3.100.0110.05312.12
5.3.90.0170.04212.08
5.3.80.0080.04412.07
5.3.70.0170.05612.08
5.3.60.0200.07312.06
5.3.50.0110.05312.00
5.3.40.0100.08112.00
5.3.30.0130.08111.96
5.3.20.0190.04411.74
5.3.10.0140.05311.71
5.3.00.0210.08511.70
5.2.170.0160.0639.20
5.2.160.0080.0459.20
5.2.150.0080.0469.20
5.2.140.0080.0459.19
5.2.130.0050.0329.16
5.2.120.0100.0459.15
5.2.110.0080.0429.16
5.2.100.0070.0459.16
5.2.90.0060.0469.16
5.2.80.0080.0479.16
5.2.70.0080.0459.16
5.2.60.0100.0449.11
5.2.50.0070.0499.08
5.2.40.0080.0469.05
5.2.30.0080.0479.04
5.2.20.0090.0449.02
5.2.10.0120.0398.94
5.2.00.0100.0438.79
5.1.60.0080.0358.08
5.1.50.0090.0378.08
5.1.40.0090.0358.06
5.1.30.0110.0398.41
5.1.20.0130.0348.43
5.1.10.0080.0378.16
5.1.00.0100.0368.15
5.0.50.0060.0316.63
5.0.40.0110.0306.50
5.0.30.0110.0846.30
5.0.20.0080.0516.27
5.0.10.0030.0706.26
5.0.00.0200.0706.24
4.4.90.0080.0484.78
4.4.80.0100.0314.75
4.4.70.0070.0234.75
4.4.60.0050.0474.75
4.4.50.0050.0264.77
4.4.40.0140.0644.70
4.4.30.0050.0214.75
4.4.20.0070.0204.84
4.4.10.0060.0224.85
4.4.00.0080.0334.76
4.3.110.0050.0314.67
4.3.100.0050.0204.66
4.3.90.0030.0234.63
4.3.80.0080.0324.58
4.3.70.0030.0294.63
4.3.60.0080.0414.63
4.3.50.0110.0444.63
4.3.40.0080.0384.53
4.3.30.0060.0373.29
4.3.20.0100.0533.26
4.3.10.0090.0243.23
4.3.00.0030.0207.79

preferences:
38.83 ms | 401 KiB | 5 Q