note 84148 added to language.namespaces

From: Date: Tue, 01 Jul 2008 08:19:40 +0000
Subject: note 84148 added to language.namespaces
Groups: php.notes 
Request: Send a blank email to php-notes+get-141024@lists.php.net to get a copy of this message
So do you mean if i want to use a class, i need to do extra two steps? 1) require/include that file 2) use the namespace What about to add a trigger something like: function __auto_namespace($names, $class) { if ($class === null) { set_include_dir(implode('/', $names)); } else { require_once implode('/', $names).'/'.$class.'.php'; } } Then when we: use NAMESPACE1::NAMESPACE2; or use NAMESPACE1::NAMESPACE2::CLASS1; php could auto include the file we needed. ---- Server IP: 64.71.164.2 Probable Submitter: 58.24.107.70 ---- Manual Page -- http://www.php.net/manual/en/language.namespaces.php Edit -- https://master.php.net/note/edit/84148 Del: integrated -- https://master.php.net/note/delete/84148/integrated Del: useless -- https://master.php.net/note/delete/84148/useless Del: bad code -- https://master.php.net/note/delete/84148/bad+code Del: spam -- https://master.php.net/note/delete/84148/spam Del: non-english -- https://master.php.net/note/delete/84148/non-english Del: in docs -- https://master.php.net/note/delete/84148/in+docs Del: other reasons-- https://master.php.net/note/delete/84148 Reject -- https://master.php.net/note/reject/84148 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141024) next »