box_class_01.php

<?php
class Box {

  //Properties
   private $_length;
   private $_width;
   private $_height;

  //Constructor
   public function __construct($length, $width, $height) {
   $this->_length = $length;
   $this->_width = $width;
   $this->_height = $height; 
 }

  //Method
   public function volume() {
     return $this->_length * $this->_width * $this->_height;
  }

}
?>
Top
RSS
Facebook
Facebook
Google+
Google+
https://www.paulvgibbs.com/learn-php-and-mysql-web-programming/code-samples/chapter-19/box_class_01-php