<?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, 'blue');
echo sprintf('El área del circulo color %s y con radio de longitud %s es: %s',
$circle->get_color(), $circle->get_radio(), $circle->calculateArea());
?>
Parse error: syntax error, unexpected '$radio' (T_VARIABLE), expecting heredoc end (T_END_HEREDOC) in /in/f9djr on line 19
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_VARIABLE, expecting T_END_HEREDOC in /in/f9djr on line 19
Process exited with code 255.