3v4l.org

run code in 300+ PHP versions simultaneously
<?php class induk { protected $alas=10; protected $miring=8; public function setAlas() { return ($this->alas/2); } public function setMiring() { return ($this->miring/2) } } class anak { protected $tinggi= public function hitungTinggi() { } } class cucu { public $pesan private function hitungLuas() { } } $CP2 = new induk(); echo CP2->setAlas(); echo PHP_EOL; echo CP2->setMiring(); echo PHP_EOL ?>
Output for 7.1.0 - 7.1.23, 7.2.0 - 7.2.11
Parse error: syntax error, unexpected '}', expecting ';' in /in/AXqVO on line 14
Process exited with code 255.
Output for 5.6.38
Parse error: syntax error, unexpected '}' in /in/AXqVO on line 14
Process exited with code 255.

preferences:
185.81 ms | 1395 KiB | 44 Q