View Single Post
09-30-2009, 09:40 PM
Join Date: Sep 2009
My name is Chris, most internet people call me "Sneaky".
I live in New Zealand and talk about New Zealand things very often.
I like to drag up old, dead threads, double post, and ramble on at length before getting to the punch line.
Actually I only registered to post one reply to one thread, and that was a few months old. My work here is done now. The email notification of the welcome PM is what drew me back for this second post.
PHP has been one of my interests in a big way for a number of years now. I'm self taught, I don't consider myself a pro by any means, but I do alright. I know about things like scope, cross site scripting, member visibility, abstraction, controlling the compiler and the garbage collector, bytecode compiling, streams, serializers, the DOM, regular expressions...
I know many of the warnings, gotchas and usage recommendations from the frequently used functions's pages on php.net (don't use a powerful string splitter when humble explode() will do the job, don't use c-style filesystem functions if file_get_contents() will due the job due to smarter memory mapping)... But I also know when these are misleading.
For instance, calling explode() a thousand times can actually be slower than clever re-use of regular expressions.
regexes are still normally the wrong tool for the job, but they're not as fast as the manual makes out. You can use regexes hundreds of times in the time it takes to do one DOMDocument->LoadHTML() - but then once the DOM is loaded, if you're going to select a few tens of thousands of elements, it becomes faster than regexes again. Likewise, file_get_contents() is actually often (usually?) SLOWER than fopen() and company, at least in php5.2 - although you should still use file_get_contents() just because it's easier to actually read. (and is less verbose)
I know how to write code that executes reasonably efficiently (make use of the references!), and I know how to write code which parses quickly (make use of single quotes!), but I don't yet know what's happening on the symbol table for example, and I haven't read much of PHP's C source to REALLY understand what's happening.
I came to PHP quite accidentally from the web, and now more and more often I am finding myself using it on the desktop with the cli sapi - usually just as a regular terminal app. Sometimes with QT, sometimes with GTK (this is about learning)... I've tried ncurses but I'm not a huge fan. I think it wold grow on me in time though.
Well, there's my life story.
You won't read :P but maybe I can come back and check my progress later.
I've said enough that some of it is bound to be naive ;)
View Public Profile
Send a private message to SneakyWhoami
Find More Posts by SneakyWhoami