When the people who "designed" PHP did so, why did they think no existing language would do the trick? What was the problem with all the existing languages?
Everything -> not bundled -> PHP
Perl -> too weird -> PHP
It's hard to explain to a novice that in Perl 4/5, $x[42] dereferences @x, not $x (which are completely separate, except when they're not, due to *x). And PHP has a much more typical object system. I think we agree that most all of PHP's distinctive and non-mainstream design decisions have been bad ones, though.
> It's hard to explain to a novice that in Perl 4/5, $x[42] dereferences @x, not $x (which are completely separate, except when they're not because of (star)x).
(I don't know how to protect the star from starting an emphasise block. Escaping it doesn't seem to work.)
Sorry to nit-pick, but these may be particularly hard to explain because they're not true.
$x[42] isn't a de-reference at all, but an indexing. (Granted, it's more than a little confusing that it's indexing @x. This is 'fixed' in Perl 6.) $x->[42] is a de-reference, but of $x, not of @x (which isn't a reference anyway (I think unlike in Ruby)). @x and $x are always completely separate; typeglobs allow you to say something like (star)x = \@y, whereupon @x and @y are the same (but still $x and @x are completely different). I suppose you could claim that $x and @x are no longer completely different if you say something like $x = \@x, whereupon $x->[42] and $x[42] mean the same thing.
(On using *, the trick is not to put two in the same paragraph with words between.)
You're right, "dereference" was a poor choice of words because it means something more specific in Perl. And I think a programmer would need at least a year of experience before they could possibly understand your main paragraph, while PHP was dumbed-down enough to be approachable by amateurs.
Yes it can be confusing to a novice how Perl sigils work. Hence Larry Wall conceded this as an issue and so one of the reasons he went for invariant sigils in Perl6.
However there is logic in the madness. Perhaps Larry Wall/linguistic logic but none the less it does work! The best explanation i've see is the comment by "Matt S Trout" on devolving-sigils blog post (http://blog.fogus.me/2009/02/26/devolving-sigils/).
Below is the key sentence from mst comment:
Actually, perl sigils don’t denote variable type
– they denote conjugation
– $ is ‘the’, @ is ‘these’, % is ‘map of’ or so
– variable type is denoted via [] or {}.
Rasmus Lerfdorf (designer of PHP) did an interview where he explained PHP's origins http://www.twit.tv/floss12.
It's been a long time since I listened to the interview, but I think he created PHP to create simple websites. Wikipedia even says the original acronym was "Personal Home Page".
The problem PHP tried to fix (and largely succeeded) had very little to do with the language, and a lot to do with the deployment of products written in that language, as I understand it.
What problem were they trying to fix?