aakash2310

Untitled

Nov 28th, 2022
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. </head>
  9. <body>
  10. <?php
  11. class RectangleOne
  12. {
  13. public $length = 0;
  14. public $width = 0;
  15. public function getPerimeter()
  16. {
  17. return "<br> Perimeter is : ".(2*($this->length + $this->width));
  18. }
  19. public function getArea()
  20. {
  21. return "<br> Area is : ".($this->length * $this->width);
  22. }
  23. }
  24. $obj = new RectangleOne();
  25. $obj -> length=10;
  26. $obj -> width=20;
  27. echo $obj-> getPerimeter();
  28. echo $obj-> getArea();
  29. ?>
  30. </body>
  31. </html>
Advertisement
Add Comment
Please, Sign In to add comment