3v4l.org

run code in 300+ PHP versions simultaneously
<?php class induk { protected function alas() { return "miring"; } } class anak extends induk { protected function tinggi() { return "hitung tinggi"; } } class cucu extends anak { protected function public() { return "hitun tinggi"; } public function hitung(){ $a = $this->set tinggi(); $b = $this->hitung tinggi(); $c = $this->hitung luas(); return "$a <br /> $b <br /> $c"; } } $gadget_baru = new induk(); echo $gadget_baru->hitung() ?>
Output for 7.1.0 - 7.1.23, 7.2.0 - 7.2.11
Parse error: syntax error, unexpected 'tinggi' (T_STRING) in /in/9fFSd on line 20
Process exited with code 255.
Output for 5.6.38
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting identifier (T_STRING) in /in/9fFSd on line 15
Process exited with code 255.

preferences:
182.74 ms | 1395 KiB | 44 Q