Jump to content

subclasses & privacy modifiers


nodirtyrockstar

Recommended Posts

var should not be used, it's a PHP4 convention and has been obsolete since PHP5 was released. It's mapped as an alias to public and still works only for backwards compatibility reasons. New code should use either public, private, or protected to declare the variables, which ever is appropriate for that variable.

 

class Klass { 
   public $aPublicVar;
   protected $aProtectedVar;
   private $aPrivateVar;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.