3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class segitiga { protected $alas; protected $tinggi; public function setalas ($a) { $pr=$this->$alas; $pr=10; return $pr; } public function settinggi ($a) { $tgg=$this->$tinggi; $tgg=15; return $tgg; } } class hitmir extends segitiga { protected $miring; private function hit($a) { $mir=($pr*$pr+$tgg*$tgg); } } $ob= new segitiga(); $ob2= new hitmir(); echo PHP_EOL; $ob2->this->hit();
based on GGfWF
Output for 7.0.28 - 7.3.0rc3
Notice: Undefined property: hitmir::$this in /in/pg15B on line 31 Fatal error: Uncaught Error: Call to a member function hit() on null in /in/pg15B:31 Stack trace: #0 {main} thrown in /in/pg15B on line 31
Process exited with code 255.
Output for 5.6.38
Notice: Undefined property: hitmir::$this in /in/pg15B on line 31 Fatal error: Call to a member function hit() on null in /in/pg15B on line 31
Process exited with code 255.