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(); } } // per manual: ArrayObject constructed from array means all properties are public. $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.0140.00316.88
8.3.50.0140.00422.09
8.3.40.0070.01118.71
8.3.30.0100.01018.83
8.3.20.0000.00720.18
8.3.10.0040.00423.69
8.3.00.0100.00017.75
8.2.180.0040.01116.88
8.2.170.0140.00722.96
8.2.160.0100.00320.29
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0130.00626.16
8.2.120.0040.00422.26
8.2.110.0100.00720.57
8.2.100.0070.00417.78
8.2.90.0040.00417.63
8.2.80.0060.00318.67
8.2.70.0050.00317.87
8.2.60.0080.00018.03
8.2.50.0000.00818.10
8.2.40.0060.00319.30
8.2.30.0040.00418.08
8.2.20.0000.00717.72
8.2.10.0050.00217.98
8.2.00.0120.00017.79
8.1.280.0090.00625.92
8.1.270.0080.00622.11
8.1.260.0030.00626.35
8.1.250.0080.00028.09
8.1.240.0040.00422.20
8.1.230.0030.01022.25
8.1.220.0030.00517.74
8.1.210.0040.00418.77
8.1.200.0000.01017.36
8.1.190.0040.00417.35
8.1.180.0080.00018.10
8.1.170.0000.00818.59
8.1.160.0080.00022.02
8.1.150.0050.00318.66
8.1.140.0040.00417.38
8.1.130.0000.00717.78
8.1.120.0040.00417.52
8.1.110.0000.00817.46
8.1.100.0070.00017.46
8.1.90.0000.00717.49
8.1.80.0040.00417.53
8.1.70.0040.00417.45
8.1.60.0060.00317.61
8.1.50.0050.00317.42
8.1.40.0000.00817.52
8.1.30.0040.00417.59
8.1.20.0030.00517.62
8.1.10.0000.00717.59
8.1.00.0040.00417.47
8.0.300.0070.00020.09
8.0.290.0080.00016.88
8.0.280.0000.00718.51
8.0.270.0050.00217.28
8.0.260.0000.00617.19
8.0.250.0030.00316.93
8.0.240.0000.00916.98
8.0.230.0030.00317.00
8.0.220.0000.00716.92
8.0.210.0000.00716.97
8.0.200.0090.00017.00
8.0.190.0040.00417.00
8.0.180.0040.00416.84
8.0.170.0000.00716.96
8.0.160.0000.00716.92
8.0.150.0040.00416.91
8.0.140.0040.00416.86
8.0.130.0030.00613.27
8.0.120.0060.00316.86
8.0.110.0000.00816.97
8.0.100.0000.00816.82
8.0.90.0060.00316.83
8.0.80.0070.01016.97
8.0.70.0000.00816.77
8.0.60.0000.00816.85
8.0.50.0000.00716.92
8.0.30.0130.00616.94
8.0.20.0140.00517.40
8.0.10.0040.00416.88
8.0.00.0120.01016.92
7.4.330.0050.00015.00
7.4.320.0030.00316.43
7.4.300.0030.00516.59
7.4.290.0070.00016.43
7.4.280.0080.00016.61
7.4.270.0070.00016.60
7.4.260.0070.00016.45
7.4.250.0070.00016.58
7.4.240.0020.00516.65
7.4.230.0000.00716.69
7.4.220.0160.01016.47
7.4.210.0100.00416.64
7.4.200.0000.00716.59
7.4.190.0030.00516.52
7.4.160.0030.01316.70
7.4.150.0120.00617.40
7.4.140.0160.00717.86
7.4.130.0090.00816.37
7.4.120.0070.01016.53
7.4.110.0070.02016.75
7.4.100.0140.00716.50
7.4.90.0060.01216.60
7.4.80.0150.00919.39
7.4.70.0100.00516.57
7.4.60.0030.01416.59
7.4.50.0050.00216.34
7.4.40.0080.00822.77
7.4.30.0090.00916.56
7.4.00.0060.01214.84
7.3.330.0000.00613.28
7.3.320.0030.00313.16
7.3.310.0080.00016.36
7.3.300.0030.00316.34
7.3.290.0090.01216.27
7.3.280.0060.01016.35
7.3.270.0140.00417.40
7.3.260.0120.00616.32
7.3.250.0120.00816.47
7.3.240.0100.00616.46
7.3.230.0100.00716.39
7.3.210.0100.00716.49
7.3.200.0110.00719.39
7.3.190.0160.00616.26
7.3.180.0060.01216.31
7.3.170.0110.00516.31
7.3.160.0130.00916.50
7.3.120.0040.00814.77
7.2.330.0070.01116.49
7.2.320.0070.01416.71
7.2.310.0100.01316.79
7.2.300.0040.01316.57
7.2.290.0030.01716.82
7.2.00.0040.00419.22
7.1.200.0070.00715.80
7.1.100.0030.01017.81
7.1.70.0000.00817.19
7.1.60.0100.01619.33
7.1.50.0160.00434.66
7.1.00.0100.07022.41
7.0.200.0000.01116.83
7.0.140.0030.07322.08
7.0.60.0070.08020.06
7.0.50.0030.04017.87
7.0.40.0030.04320.09
7.0.30.0230.03720.30
7.0.20.0200.04720.24
7.0.10.0000.09720.33
7.0.00.0070.08320.24
5.6.280.0000.09721.16
5.6.210.0170.06320.52
5.6.200.0030.04018.21
5.6.190.0100.05720.47
5.6.180.0170.07720.61
5.6.170.0270.08020.55
5.6.160.0070.08320.39
5.6.150.0070.05018.27
5.6.140.0070.08718.26
5.6.130.0030.05718.17
5.6.120.0070.04720.90
5.6.110.0170.07320.99
5.6.100.0030.04720.96
5.6.90.0070.09020.98
5.6.80.0000.04320.37
5.6.70.4500.04020.40
5.5.350.0130.08320.47
5.5.340.0100.08017.93
5.5.330.0070.04720.18
5.5.320.0100.07720.34
5.5.310.0300.07020.23
5.5.300.0170.05317.98
5.5.290.0030.08718.00
5.5.280.0000.04320.69
5.5.270.0100.07320.88
5.5.260.0100.05720.96
5.5.250.0070.06320.67
5.5.240.0170.08320.38
5.4.450.0300.06719.31
5.4.440.0770.07019.38
5.4.430.1130.07719.69
5.4.420.0530.07019.30
5.4.410.0770.05319.56
5.4.400.0130.05319.15
5.4.390.0700.06019.28
5.4.380.0270.05718.80
5.4.370.0330.06018.75
5.4.360.0300.05318.51
5.4.350.0400.05718.75
5.4.340.0230.07018.54
5.4.320.0080.03512.50
5.4.310.0070.03712.50
5.4.300.0100.04612.50
5.4.290.0070.03612.50
5.4.280.0130.03712.38
5.4.270.0060.04012.37
5.4.260.0100.03712.37
5.4.250.0080.04212.37
5.4.240.0100.06012.37
5.4.230.0110.05712.37
5.4.220.0150.04612.36
5.4.210.0140.05112.36
5.4.200.0130.04912.37
5.4.190.0120.06812.36
5.4.180.0130.04112.36
5.4.170.0120.04912.37
5.4.160.0250.06312.37
5.4.150.0170.06412.36
5.4.140.0060.04512.05
5.4.130.0060.04412.04
5.4.120.0070.04111.99
5.4.110.0080.04011.99
5.4.100.0070.04111.99
5.4.90.0050.04111.99
5.4.80.0050.04211.98
5.4.70.0080.03611.98
5.4.60.0110.03511.98
5.4.50.0080.04311.99
5.4.40.0070.04411.98
5.4.30.0090.04311.97
5.4.20.0060.05311.97
5.4.10.0180.04811.97
5.4.00.0070.04311.46
5.3.290.0070.03912.80
5.3.280.0100.04012.71
5.3.270.0050.04412.72
5.3.260.0080.04412.72
5.3.250.0080.03812.72
5.3.240.0100.04812.72
5.3.230.0090.03812.71
5.3.220.0120.05212.68
5.3.210.0200.06312.68
5.3.200.0190.05112.68
5.3.190.0090.04712.68
5.3.180.0140.09712.67
5.3.170.0210.07712.67
5.3.160.0090.05912.67
5.3.150.0170.05412.68
5.3.140.0130.05412.66
5.3.130.0200.08012.66
5.3.120.0100.08912.66
5.3.110.0210.09112.66
5.3.100.0110.05012.12
5.3.90.0150.07212.09
5.3.80.0150.05012.08
5.3.70.0120.05112.08
5.3.60.0070.03912.07
5.3.50.0090.03912.00
5.3.40.0080.04112.00
5.3.30.0070.03811.96
5.3.20.0100.03611.74
5.3.10.0100.03711.71
5.3.00.0100.04011.70
5.2.170.0130.0459.20
5.2.160.0210.0509.21
5.2.150.0090.0529.20
5.2.140.0100.0539.20
5.2.130.0060.0339.16
5.2.120.0080.0399.15
5.2.110.0100.0459.16
5.2.100.0080.0409.16
5.2.90.0100.0409.16
5.2.80.0080.0429.16
5.2.70.0090.0459.16
5.2.60.0120.0449.11
5.2.50.0120.0479.08
5.2.40.0100.0409.05
5.2.30.0100.0389.04
5.2.20.0100.0289.02
5.2.10.0060.0378.94
5.2.00.0110.0288.79
5.1.60.0020.0298.08
5.1.50.0060.0258.08
5.1.40.0070.0238.06
5.1.30.0080.0248.41
5.1.20.0070.0258.43
5.1.10.0030.0278.16
5.1.00.0100.0228.15
5.0.50.0060.0246.63
5.0.40.0030.0306.50
5.0.30.0060.0406.30
5.0.20.0160.0586.27
5.0.10.0170.0546.25
5.0.00.0080.0456.24
4.4.90.0070.0204.78
4.4.80.0050.0234.76
4.4.70.0050.0274.76
4.4.60.0030.0224.75
4.4.50.0060.0214.77
4.4.40.0040.0364.71
4.4.30.0050.0204.76
4.4.20.0040.0204.84
4.4.10.0050.0154.84
4.4.00.0040.0304.76
4.3.110.0050.0184.67
4.3.100.0030.0224.67
4.3.90.0030.0174.64
4.3.80.0040.0244.59
4.3.70.0030.0164.63
4.3.60.0010.0174.63
4.3.50.0030.0174.63
4.3.40.0040.0244.54
4.3.30.0080.0163.28
4.3.20.0020.0203.26
4.3.10.0050.0203.23
4.3.00.0030.0207.79

preferences:
46.05 ms | 400 KiB | 5 Q