Variable names
A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.
Compare to:
<?php
$a = 1;
$$a = 'foo';
print ${1};
?>So the restriction that the variable name can not start with a number is only enforced by the parser and even then it's fairly easy to circumvent. Maybe it would have been simpler to explain and implement if the definition would be "A valid variable name contains any number of letters, numbers, or underscores".

Comments
Your suggestion?
Would you rather see variables not starting with numbers at all, or allowing variables starting with numbers by the parser as well?
given the state of affairs
add numbers to the parser. it will be a wtf too ($123 looks fun) but a lot smaller wtf.
Post new comment