Categories
php

Public, Private, and Protected in PHP

or how to manage access to your classes.

In PHP there are three levels of access for properties and methods from within a class: public, private, and protected.

Public access is the default setting for method and for properties.

  • Public properties and methods can be accessed from any context.
  • Private methods and properties can ONLY be accessed from within the enclosing class. The subclasses have no access to them.
  • Protected methods and properties can be accessed from within the enclosing class and from subclasses.

According with Zend Coding Standards, variables that are declared with the “private” or “protected” modifier, the first character of the variable name must be a single underscore.

eg: private $_myVar;

Categories
general

World friendship with Facebook

What can I say?… wow…

High-res of this photo here.

Categories
general

First post

I’m a web developer from Romania (currently working in Netherlands) and this is my first WebDev Blog.

I don’t know yet what I will write here so meanwhile I invite you to read my blogroll.