?

Log in

No account? Create an account
I hate PHP. It just took me a good ten minutes to realise that I had… - 'Twas brillig, and the slithy toves did gyre and gimble in the wabe — LiveJournal [entries|archive|friends|userinfo]
Thomas

[ website | Beware the Jabberwock... ]
[ deviantArt | the-boggyb ]
[ FanFiction | Torkell ]
[ Tumblr | torkellr ]

Links
[Random links| BBC news | Vulture Central | Slashdot | Dangerous Prototypes | LWN | Raspberry Pi]
[Fellow blogs| a Half Empty Glass | the Broken Cube | The Music Jungle | Please remove your feet | A letter from home]
[Other haunts| Un4seen Developments | Jazz 2 Online | EmuTalk.net | Feng's shui]

[Tuesday 18th July 2006 at 10:18 pm]
Thomas

boggyb
[Playing |Around the World (Radio Edit) ~ Daft Punk/Musique, Vol. 1 1993-2005]

I hate PHP.

It just took me a good ten minutes to realise that I had typed $ids[i] instead of $ids[$i] in a PHP script.

And this is far from the first time I've made that mistake, which is because all the *real* programming languages I know have grown out of using prefixes to denote variables, and would not fail silently in such a case (well, VB would if you're mad enough to code without Option Explicit, but C and Java would fail noisily).

Did I mention that I hate PHP?
Link | Previous Entry | Share | Next Entry[ 9 pennies | Penny for your thoughts? ]

Comments:
[User Picture]From: ralesk
Tuesday 18th July 2006 at 9:34 pm (UTC)

Perl for the win.

(Reply) (Thread)
[User Picture]From: boggyb
Tuesday 18th July 2006 at 9:36 pm (UTC)
Nooooooooooooooooooooooooooooooooooooooooooooooooo!
(Reply) (Parent) (Thread)
[User Picture]From: olego
Wednesday 19th July 2006 at 4:50 pm (UTC)

Perl X_X

Perl, mind you, isn't much better. My loyalty to it is failing: I can't write anything without looking it up. The latest problem I had was that the break keyword should actually have been the last keyword, even thought the break worked perfectly fine.

And don't even get me started on the 5 ways you can call a subroutine:

a();
&a();
a;
&a;
goto &a;

I mean, yes, all five are slightly different, but for Crissakes! And typeglobs? And automatically flattened lists UNLESS you use references, in which case it's $var{$something} or $var->$something... Grr.
(Reply) (Parent) (Thread)
[User Picture]From: pleaseremove
Tuesday 18th July 2006 at 10:53 pm (UTC)
Oh come on, you love it really.

You think thats bad, try searching for this difference in 500 lines....

({
(Reply) (Thread)
From: brokencube
Wednesday 19th July 2006 at 1:19 am (UTC)
You think that's bad?

Trying to find a bug in 400 lines of code: I had accidentally written '<<' instead of '>>' ....

That was a headache and a half.
(Reply) (Parent) (Thread)
[User Picture]From: olego
Wednesday 19th July 2006 at 4:40 pm (UTC)
There's a better reason to hate PHP:

How do you spell a function name?

First, there are abnoxious names, such as nl2br. I mean, seriously, what the fsck? Sounds like Netherlands 2 Britain, for crying out loud.

Then there are functions without underscore. htmlspecialchars, for example.

Lastly, there are functions with underscores. mysql_escape_string. Actually, a better function is mysql_real_escape_string, because the first one is actually fake.

Once again, WTF!? Why do you have split, explode, and preg_split, spliti, and str_split? It's awful and ugly. So my fav. languages are C, Scheme, and JavaScript.
(Reply) (Thread)
[User Picture]From: boggyb
Thursday 20th July 2006 at 9:54 am (UTC)
How about this for a better reason:

$foo = "banana\n";

echo "Before doStuff:" . $foo;
doStuff();
echo "After doStuff:" . $foo;

function doStuff()
{
    echo "Entering doStuff:" . $foo;
    $foo = "apple\n";
    echo "Leaving doStuff:" . $foo;
}

Without running it, guess what it'll output.

Then try to name another mainstream programming language which behaves the same way.
(Reply) (Parent) (Thread)
[User Picture]From: olego
Thursday 20th July 2006 at 5:27 pm (UTC)
Behaves just as expected by me. Yea, I admit that the idea of global and superglobal variables is a bit quirky, but what's even more quirky is being able to use variables before defining them.

Fine, it's a scripting language, etc., etc. :-)
(Reply) (Parent) (Thread)
[User Picture]From: boggyb
Thursday 20th July 2006 at 9:13 pm (UTC)
I can cope with the latter (it's pretty traditional in scripting languages, and VB6 lets you work like that if you don't use Option Explicit), but the former has tripped me up several times. It's the only language I know where the rules for scope are different.
(Reply) (Parent) (Thread)