Fine, print vs printf aside, in his very first post he said it could be easily adapted to any kind of array, so assuming the input will be JSON formatted is bad.
No, not really. He wrote a regular expression because he wasn't aware of the built in JSON capabilities. In reality, it should be using json_decode.
If you're writing a generic parser, then regular expressions is a
reasonable way to do it, but it's not the most efficient. That's what I'm getting at. I'm sure I'd elect to use regex instead of writing a lexer, tokenizer, parser, etc. However, you were nitpicking on matters of efficiency, and it didn't seem appropriate to do that and use regular expressions in the same breath...
I'm pointing out a double-standard, not saying using regular expressions is inappropriate.
And as for readability, comments exist for a reason, although they should be used to explain why, not how (I'll give you that one). Additionally, changing " to ' boosts performance and doesn't mangle readability like you seem to be implying.
Comments only go so far. They don't make a hideously mangled line of code easier to follow or modify...
The performance boost isn't worth considering for almost all applications, and it can easily mangle readability. If you're printing HTML, it's much easier to keep track of where you are and what quotes/braces need closed if you use printf instead of print with single ticks.
Of course I'm willing to grant that there's no reason to do
print "1234";
Instead of
print '1234';
,
but I think it's absurd to bring it up as if it's going to make some sort of valuable difference in the code's performance.