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();
Output for git.master, git.master_jit, rfc.property-hooks
Luas Kubus = 8 Volume Kubus = 12 Luas Balok = 32 Fatal error: Uncaught ArgumentCountError: Too few arguments to function Hitung::volume_balok(), 0 passed in /in/A3PYF on line 41 and exactly 1 expected in /in/A3PYF:35 Stack trace: #0 /in/A3PYF(41): Hitung->volume_balok() #1 {main} thrown in /in/A3PYF on line 35
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:
55.48 ms | 401 KiB | 8 Q