Apr 162012
 
:: is for static elements while -> is for instance elements.

For example:

class Example {
 public static function hello(){
  echo 'hello';
 }
 public function world(){
  echo 'world';
 }
}

// Static method, can be called from the class name
Example::hello();

// Instance method, can only be called from an instance of the class
$obj = new Example();
$obj->world();
 Posted by at 8:40 pm