3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Rixxi\Utils; class Batch implements \ArrayAccess { /** @var int */ private $limit; /** @var int */ private $counter = 0; /** @var callable */ private $callback; /** @var array */ private $values = array(); /** * @param callable $callback * @param int $limit */ public function __construct(callable $callback, $limit = 1000) { $this->callback = $callback; $this->limit = $limit; } public function __destruct() { $this->flush(); } public function add($value) { $this->values[] = $value; if (++$this->counter === $this->limit) { $this->flush(); } } public function flush() { if ($this->counter !== 0) { $callback = $this->callback; $callback($this->values); $this->values = []; $this->counter = 0; } } public function offsetSet($index, $value) { if ($index !== NULL) { throw new } $this->add($value); } public function offsetGet($index) { throw new NotSupportedException('You can only append to batch.'); } public function offsetExists($index) { throw new NotSupportedException('You can only append to batch.'); } public function offsetUnset($index) { throw new NotSupportedException('You can only append to batch.'); } }

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)
5.5.120.0100.07317.38
5.5.110.0070.08017.43
5.5.100.0000.06317.24
5.5.90.0030.05017.23
5.5.80.0070.04717.18
5.5.70.0000.04017.19
5.5.60.0030.03717.17
5.5.50.0000.04017.25
5.5.40.0030.03717.20
5.5.30.0030.03717.25
5.5.20.0000.04017.19
5.5.10.0100.03017.25
5.5.00.0000.04017.21
5.4.280.0100.07318.98
5.4.270.0100.07319.12
5.4.260.0100.07719.09
5.4.250.0130.06019.09
5.4.240.0070.03319.04
5.4.230.0100.03319.13
5.4.220.0000.04318.97
5.4.210.0030.03718.98
5.4.200.0000.05019.00
5.4.190.0000.04319.04
5.4.180.0030.03719.09
5.4.170.0030.04019.09
5.4.160.0030.03718.96
5.4.150.0030.04019.01
5.4.140.0030.03716.43
5.4.130.0030.03316.40
5.4.120.0030.03316.32
5.4.110.0000.03716.41
5.4.100.0030.03716.41
5.4.90.0000.03716.33
5.4.80.0000.03716.37
5.4.70.0000.05316.39
5.4.60.0030.04316.38
5.4.50.0000.03716.36
5.4.40.0070.03016.34
5.4.30.0030.03316.26
5.4.20.0000.03716.21
5.4.10.0000.03716.28
5.4.00.0000.03715.77
5.3.280.0100.04014.68
5.3.270.0030.03714.65
5.3.260.0030.03714.59
5.3.250.0030.03314.67
5.3.240.0030.03714.66
5.3.230.0000.04014.57
5.3.220.0030.03314.59
5.3.210.0030.04314.64
5.3.200.0070.03314.43
5.3.190.0100.03014.43
5.3.180.0000.03714.67
5.3.170.0030.03314.61
5.3.160.0070.03314.63
5.3.150.0030.03714.79
5.3.140.0000.03714.57
5.3.130.0030.04014.51
5.3.120.0030.03714.57
5.3.110.0000.04014.55
5.3.100.0030.03714.00
5.3.90.0000.03714.05
5.3.80.0030.03714.06
5.3.70.0130.02314.23
5.3.60.0070.03014.02
5.3.50.0000.04313.96
5.3.40.0000.03713.96
5.3.30.0030.06013.95
5.3.20.0030.06313.70
5.3.10.0130.06713.71
5.3.00.0030.07313.54

preferences:
137.29 ms | 1394 KiB | 7 Q