3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $a; protected $b; public $c; } class FooCountable implements \Countable { private $elements = [1,2,3]; public function count() { return count($this->elements); } } $tests = [ 'array' => [1,2,3], 'string' => 'hello world', 'number' => 123, 'iterator' => new \ArrayIterator([1,2,3]), 'countable' => new \FooCountable(), 'zero' => 0, 'string_zero' => '0', 'object' => new \Foo(), 'stdClass' => new \stdClass, 'null' => null, 'empty' => '', 'boolt' => true, 'boolf' => false ]; function countValid($array_or_countable, $mode = \COUNT_NORMAL) { if (\is_countable($array_or_countable)) { return \count($array_or_countable, $mode); } return null === $array_or_countable ? 0 : 1; }

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.0070.00718.56
8.3.50.0070.01116.27
8.3.40.0150.00018.57
8.3.30.0120.00318.43
8.3.20.0030.00524.18
8.3.10.0040.00424.66
8.3.00.0080.00026.16
8.2.180.0120.00325.92
8.2.170.0120.00318.87
8.2.160.0100.00322.96
8.2.150.0040.00425.66
8.2.140.0100.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00819.95
8.2.110.0070.00319.27
8.2.100.0090.00317.84
8.2.90.0030.00719.26
8.2.80.0030.00917.97
8.2.70.0050.00317.63
8.2.60.0040.00418.05
8.2.50.0040.00418.07
8.2.40.0030.00620.01
8.2.30.0070.00018.16
8.2.20.0090.00018.38
8.2.10.0040.00419.31
8.2.00.0000.00819.33
8.1.280.0140.00425.92
8.1.270.0080.00023.99
8.1.260.0090.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00322.58
8.1.230.0030.00817.76
8.1.220.0080.00017.78
8.1.210.0080.00018.77
8.1.200.0030.00717.35
8.1.190.0080.00017.35
8.1.180.0080.00018.10
8.1.170.0000.00818.46
8.1.160.0040.00418.84
8.1.150.0030.00618.79
8.1.140.0000.00718.98
8.1.130.0000.00820.30
8.1.120.0000.01017.52
8.1.110.0080.00017.48
8.1.100.0050.00217.54
8.1.90.0070.00017.50
8.1.80.0040.00417.48
8.1.70.0030.00317.52
8.1.60.0030.00617.50
8.1.50.0000.00917.43
8.1.40.0040.00417.51
8.1.30.0030.00517.54
8.1.20.0040.00417.52
8.1.10.0080.00017.45
8.1.00.0050.00317.49
8.0.300.0030.00618.77
8.0.290.0040.00416.88
8.0.280.0080.00018.43
8.0.270.0030.00317.92
8.0.260.0000.00618.45
8.0.250.0070.00016.97
8.0.240.0030.00316.98
8.0.230.0000.00716.84
8.0.220.0030.00516.91
8.0.210.0070.00016.96
8.0.200.0000.00717.00
8.0.190.0030.00516.89
8.0.180.0040.00416.97
8.0.170.0000.00816.82
8.0.160.0080.00016.82
8.0.150.0000.00816.78
8.0.140.0040.00416.86
8.0.130.0000.00613.31
8.0.120.0040.00416.88
8.0.110.0080.00016.96
8.0.100.0000.00716.89
8.0.90.0050.00216.98
8.0.80.0190.00016.91
8.0.70.0040.02116.93
8.0.60.0150.01016.83
8.0.50.0140.01416.80
8.0.30.0180.00616.80
8.0.20.0210.00317.00
8.0.10.0160.01017.07
8.0.00.0060.01216.98
7.4.330.0000.00515.55
7.4.320.0060.00016.68
7.4.300.0030.00316.54
7.4.290.0040.00416.46
7.4.280.0080.00016.54
7.4.270.0050.00316.53
7.4.260.0040.00416.58
7.4.250.0060.00316.58
7.4.240.0080.00016.69
7.4.230.0030.00316.60
7.4.220.0070.00016.28
7.4.210.0160.00616.66
7.4.200.0090.01416.55
7.4.190.0100.01416.58
7.4.180.0180.00716.77
7.4.160.0200.00316.70
7.4.150.0160.00616.51
7.4.140.0140.01016.53
7.4.130.0160.00816.46
7.4.120.0180.00516.53
7.4.110.0200.00716.41
7.4.100.0190.00416.53
7.4.90.0210.01216.43
7.4.80.0200.00916.61
7.4.70.0180.00916.43
7.4.60.0160.00716.52
7.4.50.0180.00516.26
7.4.40.0170.00716.36
7.4.30.0170.01016.32
7.4.20.0150.00916.42
7.4.10.0190.00816.47
7.4.00.0170.00916.40
7.3.330.0030.00516.11
7.3.320.0030.00313.33
7.3.310.0050.00216.08
7.3.300.0050.00316.22
7.3.290.0190.00316.25
7.3.280.0170.00616.26
7.3.270.0180.00616.32
7.3.260.0090.01416.23
7.3.250.0160.01216.30
7.3.240.0190.01316.27
7.3.230.0260.00816.16
7.3.220.0240.00016.23
7.3.210.0250.00016.20
7.3.200.0240.00416.16
7.3.190.0180.00716.16
7.3.180.0170.00816.20
7.3.170.0210.00716.27
7.3.160.0190.00816.11
7.3.150.0200.00716.20
7.3.140.0200.01216.32
7.3.130.0150.01116.27
7.3.120.0170.00716.24
7.3.110.0240.00416.13
7.3.100.0250.00316.08
7.3.90.0140.01016.35
7.3.80.0190.00616.12
7.3.70.0120.01216.27
7.3.60.0240.00016.28
7.3.50.0210.00316.44
7.3.40.0080.02016.34
7.3.30.0190.00616.38
7.3.20.0170.00816.32
7.3.10.0190.00816.34
7.3.00.0200.00616.28

preferences:
66.05 ms | 400 KiB | 5 Q