3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Segitiga { protected $alas; protected $tinggi; public function __construct($alas,$tinggi){ $this->alas = $alas; $this->tinggi = $tinggi; } public function hitungLuas(){ return (0.5 * $this->alas * $this->tinggi); } } class SisiMiring { protected $miring; } function hitungSisiMiring(){ return ($this->miring = $segitiga * 2); } $segitiga = new Segitiga(4,5); echo 'Luas Segitiga = '.$segitiga->hitungLuas() . "\n"; $sisimiring = new SisiMiring(); echo 'Sisi Miring Segitiga ='.$sisimiriing->hitungSisiMiring()."\n"; ?>
Output for git.master, git.master_jit, rfc.property-hooks
Luas Segitiga = 10 Warning: Undefined variable $sisimiriing in /in/seAIA on line 29 Fatal error: Uncaught Error: Call to a member function hitungSisiMiring() on null in /in/seAIA:29 Stack trace: #0 {main} thrown in /in/seAIA on line 29
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
50.83 ms | 401 KiB | 8 Q