Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Square {
- public $width;
- public $height;
- function __construct($width, $height) {
- $this->width = $width;
- $this->height = $height;
- }
- function area(){
- $area = $this->width * $this->height;
- return $area;
- }
- function get_width() {
- return $this->width;
- }
- function get_height() {
- return $this->height;
- }
- function setWidth($width){
- $this->width = $width;
- }
- function setHeight($height){
- $this->height = $height;
- }
- }
- $square1 = new Square(7, 8);
- echo $square1->area();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement