Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Backslash before function name in PHP

692 views
Skip to first unread message

cityuk

unread,
Mar 13, 2011, 10:01:48 PM3/13/11
to
Dear All,

I was looking for advanced PHP OO programming tutorials and came
across www.afascripts.com.

They present nice tutorials, but one thing puzzled me: in some of the
code there are backslashes before function names, e.g.:

\spl_autoload_register(array($autoLoader, 'load'));
\class_exists($classname) || \interface_exists($classname)){
if (\file_exists($file)){


(have a look at http://www.afascripts.com/2011/01/07/basics-1-autoloading/#respond).

What does the backslash before the function name do?

Regards,
George

Helmut Chang

unread,
Mar 14, 2011, 2:31:22 AM3/14/11
to
Am 14.03.2011 03:01, schrieb cityuk:

> They present nice tutorials, but one thing puzzled me: in some of the
> code there are backslashes before function names, e.g.:
>
> \spl_autoload_register(array($autoLoader, 'load'));
> \class_exists($classname) || \interface_exists($classname)){
> if (\file_exists($file)){
>

> [...]


>
> What does the backslash before the function name do?

It's a PHP 5.3 feature:

<http://www.php.net/manual/en/language.namespaces.php>

Helmut

0 new messages