3v4l.org

run code in 300+ PHP versions simultaneously
<?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.1.23, 7.2.0 - 7.2.11
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
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting function (T_FUNCTION) in /in/MWQuC on line 14
Process exited with code 255.

preferences:
176.67 ms | 1395 KiB | 44 Q