3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class factorial_of_a_number{ protected $_n; public function __construct($n){ if(!is_int($n)){ throw new InvalidArgumentException('Not a Number'); } $this->_n=$n; } function result(){ $factorial = 1; for($i=1;$i<=$this->_n;$i++){ $factorial *= $i } return $factorial; } } $objekt = new factorial_of_a_number(2); echo $objekt ->result();
Output for 5.3.0 - 5.4.30
Parse error: syntax error, unexpected '}' in /in/fhbGR on line 15
Process exited with code 255.