3v4l.org

run code in 300+ PHP versions simultaneously
<?php class AntAlgorithm { private $ant_size; private $gen_limit; private $ant_food; private $ant_constraint; private $ant_colony; private $pheronome; private $food_storage; public function construct() { $this->pheronome = new Pheronome(); } public function set_antCount($antCount = 1) { $this->ant_size = $antCount; } public function set_genLimit($genLimit = 1) { $this->gen_limit = $genLimit; echo "Generasi di set " . $genLimit; } public function set_food($arrFood = array()) { $this->ant_food = $arrFood; } public function set_storage($arrStorage = array()) { $this->food_storage = $arrStorage; } public function set_constraint($arrConstraint = array()) { $this->ant_constraint = $arrConstraint; } public function tellAntToCollectTheFood() { $this->orderTheAnt(); for($gen=0;$gen<$this->gen_limit;$gen++) { foreach($this->ant_colony as $antId => $ant) { $ant->set_storage($this->food_storage [$gen][$antId]); $ant->collectThatFood(); $ant->putTheFoodOnStorage(); $this->food_storage[$gen][$antId] = $ant->get_storage(); } } } public function getCollectedFood() { return $this->food_storage; } private function orderTheAnt() { for($i=0;$i<$this->ant_size;$i++) { $myAnt = new Ant($this->ant_food); $myAnt->setPheronome($this->pheronome); $myAnt->set_constraint($this->ant_constraint); $this->ant_colony[] = $myAnt; } } public function fitnessCount() { foreach($this->food_storage as $gen => $antResult) { foreach($antResult as $antId => $food_result) { foreach($food_result as $dayId => $timeResult) { foreach($timeResult as $timeId) } } } } } ?>

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.4.50.0030.06316.37
5.4.40.0030.04316.52
5.4.30.0100.07316.38
5.4.20.0070.03316.36
5.4.10.0030.04316.55
5.4.00.0030.04315.80
5.3.150.0100.04314.61
5.3.140.0100.06314.64
5.3.130.0070.07314.61
5.3.120.0000.05714.73
5.3.110.0000.04714.46
5.3.100.0000.06014.22
5.3.90.0170.06714.10
5.3.80.0030.06714.20
5.3.70.0030.05314.12
5.3.60.0070.07313.98
5.3.50.0000.07713.86
5.3.40.0130.07014.03
5.3.30.0070.03713.99
5.3.20.0070.07013.88
5.3.10.0000.03713.75
5.3.00.0030.06713.59

preferences:
135.26 ms | 1398 KiB | 7 Q