NYCPHP Meetup

NYPHP.org

[nycphp-talk] Namespaces

David Krings ramons at gmx.net
Thu Jan 10 20:07:30 EST 2008


Kristina Anderson wrote:
> I think this has something to do with variable scope?  Such as, in ASP 
> (like VB), if you declare a variable i within a function, it loses 
> scope after the function executes and you can have another variable i 
> outside a function which stays in scope (this is NOT necessarily a 
> good thing, either).
> 
> Whereas in PHP, if you declare $i, no matter where, it will be in 
> scope throughout your entire script....right?

I don't think that is the case. That is how it used to be in the PHP 4.x 
installations that I've used early one, but with switching to PHP5 that went 
away (and all my function calls failed). I think it is possible to configure 
it either way in PHP4 or PHP5

> As someone who used ASP for many, many years....after using PHP for 5 
> months I can pretty much state that, for me at least, it's NOT better 
> than PHP, and it was a hell of a lot less fun to write.

I've never tried ASP, but I work with an application that uses 
ASP/NET/IIS/MSSQL and not only is it a royal pain the you know where to 
install, the entire application is dog slow on a P4-3GHz with 1GB RAM. I get 
better performance with PHP on my P3-1GHz while pulling everything through the 
debugger and that with less RAM.


Thanks also for all the other very informative explanations of namespace. I 
really don't see the single namespace to be an issue. When there are multiple 
namespaces I have to keep track of them as well. With multiple namespaces 
everyone starts calling their functions ini() and A(), because they are too 
lazy to type longer names. But then again, I don't really see the reason why 
one needs objects either....

David



More information about the talk mailing list