Created
March 25, 2019 05:53
-
-
Save tigersoldier/209f550b3e16affabf66a2c00315f5eb to your computer and use it in GitHub Desktop.
Sample PHP code for testing php-ls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// base class with member properties and methods | |
class Vegetable { | |
var $edible; | |
var $color; | |
function __construct($edible, $color="green") | |
{ | |
$this->edible = $edible; | |
$this->color = $color; | |
} | |
function is_edible() | |
{ | |
return $this->edible; | |
} | |
function what_color() | |
{ | |
return $this->color; | |
} | |
} // end of class Vegetable | |
// extends the base class | |
class Spinach extends Vegetable { | |
var $cooked = false; | |
function __construct() | |
{ | |
parent::__construct(true, "green"); | |
} | |
function cook_it() | |
{ | |
$this->cooked = true; | |
} | |
function is_cooked() | |
{ | |
return $this-> | |
return $this->cooked; | |
} | |
} // end of class Spinach | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment