Skip to content

Instantly share code, notes, and snippets.

@pssubashps
Created July 12, 2016 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pssubashps/94c1ac17551374a2029d2675732d5837 to your computer and use it in GitHub Desktop.
Save pssubashps/94c1ac17551374a2029d2675732d5837 to your computer and use it in GitHub Desktop.
Public Access Specifier in PHP example
<?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