3v4l.org

run code in 300+ PHP versions simultaneously
<?php class persegi { private $p; private $l; private $luas; /*public function __construct($p,$l)//construktor tanpa parameter default { $this->p=$p;$this->l=$l; }*/ public function __construct($p,$l=5) { $this->p=$p;$this->l=$l; } public function hasil() { $this->luas=$this->p*$this->l; return "Nilai Luas = ".$this->luas; } } //$obj=new persegi(); //pembuatan object tanpa parameter->muncul error $obj=new persegi(10); //pembuatan object berjalan sukses $obj2=new persegi(7); $obj2->__construct(9,5); echo $obj->hasil();
Output for git.master, git.master_jit, rfc.property-hooks
Nilai Luas = 50

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:
109.17 ms | 405 KiB | 5 Q