3v4l.org

run code in 300+ PHP versions simultaneously
<?php class segitihga { protected $alas; protected $tinggi; protected static $a; { return $this->L=$lebar; $this->T=$tinggi; echo $v = $panjang*$lebar*$tinggi; } public function cetak() { echo $this->v=$volume; } public function cetak_pesan($print) { echo $this->pesan=$pesan; } } class luas extends segi { private $t; } class keliling extends luas { } $hitung = new segi(); echo $this->t=12; echo $this->l=10; echo $this->t=8; echo $this->v=P*L*T; echo PHP_EOL;
Output for 7.1.0 - 7.1.23, 7.2.0 - 7.2.11
Parse error: syntax error, unexpected '{', expecting function (T_FUNCTION) or const (T_CONST) in /in/GZ9Vu on line 8
Process exited with code 255.
Output for 5.6.38
Parse error: syntax error, unexpected '{', expecting function (T_FUNCTION) in /in/GZ9Vu on line 8
Process exited with code 255.

preferences:
170.41 ms | 1395 KiB | 44 Q