fork download
  1. <?php
  2. class goods {
  3. public $price;
  4. }
  5.  
  6. class table extends goods{
  7. public $color;
  8.  
  9. function __construct($price, $color) {
  10. $this->price = $price;
  11. $this->color = $color;
  12. }
  13. }
  14.  
  15. $newTable = new table(5000, "red");
  16.  
  17. print_r($newTable);
Success #stdin #stdout 0s 52488KB
stdin
Standard input is empty
stdout
table Object
(
    [color] => red
    [price] => 5000
)