3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Math { const pi = 3.14; } class CircleMath extends Math { public static function calculateArea($radio) { return parent::pi * pow($radio, 2); } } class Circle { private $radio = '0.0'; private $color = <<<EOT red EOT; public function __construct($radio, $color) { $this->radio = $radio; $this->color = $color; } public function calculateArea() { return CircleMath::calculateArea($this->radio); } public function get_radio() { return $this->radio; } public function get_color() { return $this->color; } } $className = 'Circle'; $circle = new $className(6, <<<EOF green EOF;); echo sprintf('The area of %s circle with radio %s is: %s', $circle->get_color(), $circle->get_radio(), $circle->calculateArea()); ?>
Output for 5.4.0 - 5.4.21
Parse error: syntax error, unexpected end of file in /in/fBIQG on line 46
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected $end in /in/fBIQG on line 46
Process exited with code 255.