php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #47295 Namespace fall back to global function/constant - computation speed
Submitted: 2009-02-03 20:50 UTC Modified: 2009-11-20 10:11 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: david dot thalmann at gmail dot com Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: david dot thalmann at gmail dot com
New email:
PHP Version: OS:

 

 [2009-02-03 20:50 UTC] david dot thalmann at gmail dot com
Description:
------------
Hello!

As mentioned in the documentation[1]: "PHP will fall back to global functions or constants if a namespaced function or constant does not exist". A "fall back" implies (?) more computation (in this case going through the priority list) which further implies a loss of speed/performance.

It should be mentioned in the doc - if my assumption is true (based on a excerp of the internals-mailinglist[2]), that calling a built in function fully qualified (\built_in_function()) should be prefered over unqualified (built_in_function()).

I know, this is just a small note to the doc, but built-in functions are used very often, so this could bring a lot of speed on medium to large projects.

May add this to the doc when 5.3 is out and/or when it's clear how, what and when a fallback will be used (see discussion[3]).

Regards
David

[1] http://www.php.net/namespaces.fallback
[2] http://news.php.net/php.internals/41696
[3] http://wiki.php.net/rfc/namespaceresolution


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-20 10:11 UTC] vrana@php.net
PHP documentation doesn't document PHP internals.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 12:01:28 2025 UTC