3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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);
Output for 7.0.0 - 7.2.0
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.4.10 - 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
Output for 5.3.20 - 5.3.29
Strict Standards: Declaration of Rectangle::area() should be compatible with that of Shape::area() in /in/KWBnY on line 25 Strict Standards: Declaration of Circle::area() should be compatible with that of Shape::area() in /in/KWBnY on line 37 Strict Standards: Declaration of Square::area() should be compatible with that of Shape::area() in /in/KWBnY on line 46 45, 28.26, 9