<?php
class Shape
{
public function area()
{
return 0;
}
public function sides ()
{
return 0;
}
}
class Rectangle extends Shape
{
public function area($width,$length)
{
$area = $width*$length;
echo $area . ", ";
}
public function sides()
{
}
}
class Circle extends Shape
{
public function area($radius,$pi)
{
$area = pow($radius, 2)*$pi;
echo $area . ", ";
}
public function sides()
{
}
}
class Square extends Shape
{
public function area($side)
{
$area = pow($side, 2);
echo $area;
}
}
$s = new Rectangle();
$s->area(3,15);
$c = new Circle();
$c->area(3,3.14);
$q = new Square();
$q->area(3);
Fatal error: Declaration of Rectangle::area($width, $length) must be compatible with Shape::area() in /in/KWBnY on line 17
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of Rectangle::area($width, $length) should be compatible with Shape::area() in /in/KWBnY on line 17
Warning: Declaration of Circle::area($radius, $pi) should be compatible with Shape::area() in /in/KWBnY on line 29
Warning: Declaration of Square::area($side) should be compatible with Shape::area() in /in/KWBnY on line 41
45, 28.26, 9
Warning: Declaration of Rectangle::area($width, $length) should be compatible with Shape::area() in /in/KWBnY on line 25
Warning: Declaration of Circle::area($radius, $pi) should be compatible with Shape::area() in /in/KWBnY on line 37
Warning: Declaration of Square::area($side) should be compatible with Shape::area() in /in/KWBnY on line 46
45, 28.26, 9
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Strict Standards: Declaration of Rectangle::area() should be compatible with Shape::area() in /in/KWBnY on line 25
Strict Standards: Declaration of Circle::area() should be compatible with Shape::area() in /in/KWBnY on line 37
Strict Standards: Declaration of Square::area() should be compatible with Shape::area() in /in/KWBnY on line 46
45, 28.26, 9