3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class HotelFee extends Hydratable { private $description; protected function hydrate(&$res) { if(isset($res) && $res!='') { $this->description = $res; unset($res); } } public function getDescription() { $this->checkHydation(); return $this->description; } } class HotelFees extends \ArrayIterator { function __construct(array &$res = array()) { if (count($res)) { foreach($res as $i => &$hotelFee) { $this->append(new HotelFee($hotelFee)); if(!count($hotelFee)) unset($res[$i]); } if(!count($res)) unset($res); } } /** * @return HotelFee */ public function getNext() { $o = $this->current(); $this->next(); return $o; } } $array = array("prova","ciao","hello"); $hotelFees = new HotelFees($array); //$hotelFees->rewind(); echo $hotelFees->count();
Output for 5.3.0 - 7.2.0
Fatal error: Class 'Hydratable' not found in /in/N4MjA on line 3
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/N4MjA on line 19 Fatal error: Class 'Hydratable' not found in /in/N4MjA on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/N4MjA on line 19 Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/N4MjA on line 22
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/N4MjA on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/N4MjA on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/N4MjA on line 4
Process exited with code 255.