Last active
August 29, 2015 14:08
-
-
Save srph/bd8816c53f64990e3872 to your computer and use it in GitHub Desktop.
PHP - Getter example | Getting a pogi, example.
This file contains hidden or 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 | |
| /** | |
| * Usage: | |
| * $pogi = new Pogi('Kier'); | |
| * echo $pogi->getName(); | |
| */ | |
| class Pogi { | |
| /** | |
| * @access protected | |
| */ | |
| protected $name; | |
| /** | |
| * Class constructor | |
| * @param string $pogi | |
| */ | |
| public function __construct($name) | |
| { | |
| $this->name = $name; | |
| } | |
| /** | |
| * Getter for the pogi property | |
| * @return 'Kier' | |
| */ | |
| public function getName() | |
| { | |
| return $this->name; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment