3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $squad_ids = array("1","2"); $squads = array(); $squads_num = 0; class Squad { private $id; __construct(){ $this->id = $id; } } foreach ($squad_ids as $squad_id){ $squads[$squads_num] = new Squad($squad_id); print_r($squads[$squads_num]); $squads_num++; } foreach ($squads as $squad){ print_r($squad); }
Output for 5.4.0 - 5.4.29
Parse error: syntax error, unexpected '__construct' (T_STRING), expecting function (T_FUNCTION) in /in/qq2o7 on line 8
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in /in/qq2o7 on line 8
Process exited with code 255.