I started out with Java as my professional language and before I discovered Ruby, PHP was my main programming language of choice for new projects. This was probably six to seven years ago or more. I had some pretty good times with CodeIgniter [0] and various libraries like HHMVC [1].
In any case, I digress - even back then the most striking feature of its syntax was the dollar sign prepended to variables which made me think the aesthetics of the language were sub-par or at least annoying. Clearly it did not stop me from writing lots of apps in PHP since it was more of a small annoyance, if you will, something debatable mostly for scholastic purposes.
Recently the question popped into my mind: "What is the history of the dollar sign, and why is it there?" - so like every good question I started to Google my way into some answers:
From Perl to PHP
First influence - Perl:
Perl might have inherited this from shell tools like awk et al. hence:
A Quora answer provided a useful anecdote that further connected the ideas above:
Sigils in Perl
From this we find out that $, @ and % are actually called sigils [2] in computer programming. Next stop was to see what these sigils indicated in Perl:
A Ruby comparison
Very interesting and they remind me of Ruby's shorthand or general delimited input:
%w(foo bar) # => ["foo", "bar"]
# %r() is another way to write a regular expression.
# %q() is another way to write a single-quoted string (and can be multi-line, which is useful)
# %Q() gives a double-quoted string
# %x() is a shell command
# %i() gives an array of symbols (Ruby >= 2.0.0)
# %s() turns foo into a symbol (:foo)
Conclusion
Conclusion? The dollar sign for variables in PHP is actually a vestigial sigil since compared to Perl there aren't any for arrays and hashes.
[0] - https://codeigniter.com [1] - https://github.com/jenssegers/codeigniter-hmvc-modules [2] - https://en.wikipedia.org/wiki/Sigil_(computer_programming)
This historical chain is reconstructed from secondary and Q&A sources; it is a plausible trail, not primary-source proof of PHP’s design lineage.