|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-10-26 01:56 UTC] cataphract@php.net
-Type: Bug
+Type: Feature/Change Request
[2018-07-08 14:28 UTC] cmb@php.net
-Status: Open
+Status: Suspended
[2018-07-08 14:28 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 08:00:01 2025 UTC |
Description: ------------ Currently the internal PHP function library is, well, unique. Proposed is a means to maintain backward compatibility while rectifying the problem and hopefully on the engine side speed up the process by reducing what the zend engine has to track. import keyword. import attaches the specified namespace to the current one. An error is thrown if there is a symbol collision between the namespaces. namespace Bar { function Foo(){} } namespace Test { import \Bar Foo() // works Bar\Foo() // doesn't work - try use Bar instead. } If import is asked to pull a namespace that doesn't exist there's an error. Import has one other use. namespace Test; import @PDO; This pulls the PDO library of PHP 6 into the Test namespace. This brings us back to the solution of the function library problem. PHP 6 would ship with a legacy mode set to true. In that mode everything is as now - the namespace \ having thousands of functions. Turn it off though and namespace \ is empty except for a core selection of functions and objects. The rest of the function library will be divided into libraries that can be imported as needed. Legacy functions remain available in library legacy so namespace MyNamespace; import @Legacy; would let code in MyNamespace use the current function library.