3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Kubus { public function set_sisi($s); public function luas_kubus(); public function volume_kubus(); } interface Balok { public function luas_balok($p, $l); public function volume_balok($t); } class Hitung implements Kubus, Balok{ public $p,$l,$sisi; public function set_sisi($s) { $this->sisi = $s; return $this; } public function luas_kubus() { echo "Luas Kubus = " . $this->sisi * 2 . PHP_EOL; return $this; } public function volume_kubus() { echo "Volume Kubus = " . $this->sisi * 3 . PHP_EOL; return $this; } public function luas_balok($p, $l) { $this->p = $p; $this->l = $l; echo "Luas Balok = " . $p * $l . PHP_EOL; return $this; } public function volume_balok($t) { echo "Volume Balok = " . $this->p * $this->l * $t . PHP_EOL; } } $hitung = new Hitung; echo $hitung->set_sisi(4)->luas_kubus()->volume_kubus()->luas_balok(8,4)->volume_balok(2);
Output for git.master, git.master_jit, rfc.property-hooks
Luas Kubus = 8 Volume Kubus = 12 Luas Balok = 32 Volume Balok = 64

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:
42.52 ms | 401 KiB | 8 Q