2 ms·
I don't have much experience with PHP, so I don't hate it and curse the people who inflict it on me the way I curse, say, perl programmers. My complaints are b
by Goladus 16y ago
I don't have much experience with PHP, so I don't hate it and curse the people who inflict it on me the way I curse, say, perl programmers. My complaints are basically: I tried it once and didn't like it. It was hard to write the abstractions I wanted and the results were buggy. It could just be me.
Several years ago I wrote a feature simultaneously in Python, Perl, and PHP. It was a fairly simple task-- retrieve a list of formatted strings, parse the data with regular expressions, and transform the 3-dimensional information into a 2-dimensional table.
In the python version, the regexp functions were ugly, but idiomatic and also separated into independent functions. The logic was clear and 3 years later it's still easy to understand what it's doing.
I can't find the perl version, but I remember having to use a retarded workaround because references weren't working as documented in one tiny (but essential) edge case. Basically I had to duplicate the entire program to handle two different cases. There is was probably some completely different strategy that would work better, but I didn't have three days to spend digging through perl docs to find it.
In the PHP version, I seem to have had some trouble using abstractions. The program is just one monolithic while loop with some comments. Also, I see some weird hacks in the PHP version and I don't remember why I had to use all of them. At one point I'm populating an array with empty values using 'array_fill()' and I see some temporary-looking variable names like $start_end, and there are a bunch of comparisons to arbitrary index values. For example $start_end[1] is 'start' and $start_end[2] is 'end'. There's none of this crap in the python version.
Ultimately I went with the PHP version. Because the rest of the app was already written in PHP it was far easier to deploy. A year later the feature broke for some reason and I never had the time to fix it.
So ultimately, I would probably tend to avoid PHP in the future because it doesn't seem to support my style of programming very well and I don't see many advantages to indoctrinating myself to its quirks.
- shaunxcode 16y agocan you post the code in a pastebin or is it proprietary/too involved w/ rest of the system to make sense in isolation?