this question has answer here:
- reference — symbol mean in php? 15 answers
preparing zend-exam, found question class redefined strlen-function:
namespace myframework\mystring { function strlen ($str) { return \strlen($str) * 2; // return double string-length } }
i never came across "\function"-thing before , not explanation trainer - can pls. shed light...?
introduced in php 5.3, \
namespace separator.
in example, outer strlen myframework\mystring\strlen, inner strlen global one.
without namespace definition, class , function definitions placed global space - in php before namespaces supported. prefixing name \ specify name required global space in context of namespace.
reference: http://www.php.net/manual/en/language.namespaces.global.php
Comments
Post a Comment