By 18/02/2016 14 Comments

What Is Public Access Modifier In PHP?

  • The public access modifier is used inside PHP classes.
  • The public access modifier can be prefixed with variables and functions in PHP.
  • Any variable or function which is prefixed with public access modifier that variable or function becomes available anywhere such as it can be accessed outside a class or can be accessed in another classes.


 class Class_Test{
 // following variable has public access.
 public $Site_Name = "";
 // following function has public access.
 public function display_message(){
 return "I am a public function..available at every where.";

 $class_test = new Class_Test();
 // public variable is being called.
 echo "Website: " . $class_test -> Site_Name . "<br>";
 // public function is being called.
 echo $class_test -> display_message();

Posted in: PHP, Solutions

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .