Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> The dollar signs are not the problem with PHP's variables. Their global scope is.

I think you sort of have that backwards, all variables in PHP are local unless you go out of your way to make them global (or just start typing into an empty file without any functions). I pretty much surrender the global scope. None of my variables are global except for static class members. I don't have any global functions, except static class methods.

> Quick example; if you want to pass around a callback that has state

I don't pass around callbacks that have state very often. I tune my programming style to the language that I'm working on. Often there are different ways of handling the situation in PHP -- it's is actually quite dynamic in places. I prefer to keep my pages pretty KISS anyway -- I can do hell of a lot (see my other replies) without needing stateful callbacks.

> If you are going to write PHP code that looks exactly like Java, why not just use Java and get your 70x speed boost?

I don't know, why are Java sites so painfully slow and all PHP sites so fast?



Because the Java sites are solving actual problems, and the PHP sites are selecting one row from a database and adding <blink> tags around it?


Niice. So much for intelligent commentary.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: