3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Pizza { private $size; protected $price; public function __construct() { $this->size = 'large'; $this->price = 10; } } class PanPizza extends Pizza { private $size; public function getSize() { return $this->size; } public function getPrice { return $this->price; } } $pizza = new PanPizza; var_dump($pizza->getSize());
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.21
Parse error: syntax error, unexpected '{', expecting '(' in /in/YVVfC on line 24
Process exited with code 255.

preferences:
190.44 ms | 1395 KiB | 57 Q