On Fri, Aug 12, 2011 at 3:54 PM, Jan Dolecek <juzna...@gmail.com> wrote: > Someone said that it won't be that easy, because functions are > searched within a namespace first and when they don't exist there, > then are called from global namespace. > > Example: > <?php > namespace example; > echo substr('Test', 1, 1); > > When calling function substr, Zend engine first tries to find function > example\substr. If such function doesn't exist, it tries just substr > which is found and called. Thanks to this lookup, we don't need to > escape all function calls with backslash prefix. > > <?php > echo not_found(1); > When trying to autoload a function, which one should be auto loaded? > "example\not_found" or "not_found"?
first example\not_found then \not_found if necessary. > > > > Similar situation is with constants, because of BC a non-existing > constant must result in string with the same value as constant's name. > <?php > var_dump(MY_CONSTANT); // string(11) "MY_CONSTANT" > > Some programmes rely on it (though it's not recommended) and calling > autoloader everytime would add significant load to such apps. > the autoloader shouldn't affect this, if no const is found, then the constname should be used. -- Ferenc Kovács @Tyr43l - http://tyrael.hu -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php