PDA

View Full Version : :: in PHP



Decode
12-08-2008, 06:51 PM
I was wondering what "::" is used for, I saw it in Jewish Bears signature. It was like $var = hi :: function().

Thanks :)

Agnostic Bear
12-08-2008, 07:35 PM
It's the scope resolution operator, it's similar to -> only you don't need to do $blah = new blah(); you just do include('file.php'); then className::functionName();

It allows access to static, constant and over-ridden members / methods of a class.

http://php.mirrors.ilisys.com.au/manual/en/language.oop5.paamayim-nekudotayim.php
read more here.

Want to hide these adverts? Register an account for free!