Hacker News new | past | comments | ask | show | jobs | submit login

Please do, I'll update and edit as appropriate. I wasn't aware a trivial way existed of storing a persistent variable in PHP between existed. I bet I'll feel dumb when I find out what it is, though.



You can do it with APC, but beyond that, no, your solution is the PHP way to do it.


I think his point was just that you could hard-code your list of words into the code. It would be ugly, but it would work.


Isn't that the same as loading them from file on each request?


You would also want to install an opcode cache like APC, XCache, etc. That way the code is only compiled on the first page load.

http://en.wikipedia.org/wiki/List_of_PHP_accelerators


No, because you don't have additional IO overhead.


I think that overhead would be negligible, especially if the other examples are all based on micro-frameworks (i.e. loads of files).

Premature optimisation is the root of all evil, right?


Disk IO is a massive problem at scale. This obviously isn't "at scale", so it works fine here, but avoiding hitting the disk (edit: any slow IO, really) is Performance 101.




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

Search: