3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class CP2 { protected $alas; protected $miring; public function set($a,$b) { $this->alas = $a; $this->miring = $b; echo "Alas: ".$this->alas.'<br />'."Miring: ".$this->miring.'<br />'; } } class subCP2 extends CP2 { protected $tinggi; protected function tinggi() { $this->tinggi=(pow($this->miring,2)-pow($this->alas,2)); echo "Tinggi Segitiga: ".$this->tinggi; } public function runTinggi() { echo $this->tinggi(); } } $run = new CP2(); $run = new subCP2(); $run->set(2,6); $run->runTinggi(); ?>
Output for 5.6.38 - 7.3.0rc3
Alas: 2<br />Miring: 6<br />Tinggi Segitiga: 32