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) } } } } } ?>
Output for 5.3.0 - 5.3.15, 5.4.0 - 5.4.5
Parse error: syntax error, unexpected '}' in /in/BAmHp on line 78
Process exited with code 255.

preferences:
159.38 ms | 1387 KiB | 29 Q