fork download
  1. <?php
  2. class Dog{
  3. public $numLegs = 4;
  4. public $name;
  5. public function __construct($name){
  6. }
  7.  
  8.  
  9.  
  10. public function bark(){
  11. return "Woof!";
  12. }
  13. public function greet(){
  14. return "My name is ".$this->name;
  15. }
  16.  
  17. }
  18.  
  19. $dog1 = new Dog('Barker');
  20.  
  21. echo $dog1->greet();
  22.  
  23. ?>
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
My name is