Created
July 12, 2016 08:49
-
-
Save pssubashps/94c1ac17551374a2029d2675732d5837 to your computer and use it in GitHub Desktop.
Public Access Specifier in PHP 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 | |
class Employees { | |
/** | |
* public variable | |
**/ | |
public $organization ; | |
function __construct() { | |
$this->organization = 'Nidhi Infotech'; | |
} | |
/** | |
* To get organization name | |
**/ | |
public function getOrganization(){ | |
return $this->organization; | |
} | |
} | |
$emp = new Employees; | |
echo $emp->organization; | |
echo "<br/>"; | |
echo $emp->getOrganization(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment