Once you say "namespace xyz ;" everything in the file is now relative to
namespace xyz. To refer to the global namespace, you use the following

<?php

namespace xyz ;

function substr() {
        return true ;
}

substr(); // calls substr in current namespace
::substr(); // calls substr in global namespace

?>

On Sat, 2007-12-08 at 20:12 +0000, Richard Quadling wrote:
> On 07/12/2007, Lokrain <[EMAIL PROTECTED]> wrote:
> > Hello all,
> >
> > I just wanted to drop an opp. Just to see the logic, when we have
> > programming structure class, interface, function, if statement, switch
> > statement etc, we have bracers encapsulation. This is the logic that most
> > programming language give to show a programmer that something is inside
> > something. We here have namespace with the same idea, and no bracers.
> >
> > Conclusion: namespaces are not logical => no thanks
> >
> > PS. By the way, I do not think that any workarounds on that logic will not
> > be nice.
> >
> 
> I'm trying to understand the argument against using braces.
> 
> And that has led me to the following question.
> 
> Assuming no braces, how would I put code OUTSIDE of the namespace in a
> single file.
> 
> <?php
> namespace XYZ;
> 
> xyz related code goes here
> 
> non xyz related code goes here but how do I let PHP know it isn't part of xyz?
> 
> 
> 
> Do I have to change namespace by using a dummy namespace? Same issue
> how do I refer to the global namespace.
> 
> 
> Richard.
> 
> -- 
> -----
> Richard Quadling
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"
> 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to