3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class induk { protected $a; protected $t; public function set($a,$t){ $this->a=$a; $this->t=$t; $coba = ("$a $t"); echo $coba; } class anak extends induk{ protected $m; protected function hitungsisi($a,$t){ $this->m=$m; $m = (1/2)*$a*$t; echo "sisi miring :".$m } class cucu extends anak{ public $pesan; private function keliling($a,$t,$c){ } $this->m =$c $keliling = $c + $a + $t } } } $lala = new induk(); $nana = new anak(); $tata = new cucu(); echo $lala-> set(4 , 7); echo PHP_EOL; ?>
Output for 7.1.0 - 7.3.0rc3
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting function (T_FUNCTION) or const (T_CONST) in /in/MWQuC on line 14
Process exited with code 255.
Output for 5.6.38 - 7.0.28
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting function (T_FUNCTION) in /in/MWQuC on line 14
Process exited with code 255.