In most programming languages, variables do not have identifying characters like they do in PHP. In PHP you must prefix a variable with the $ character.Example; var $foo = something; echo $foo;I'm developing a new scripting language for a business application, and my target users do not have a programming background. Do these characters make code easier to read and use?One reason PHP uses the $ is because without it PHP can't tell if a name is a function reference or variable reference. This is because the language allows strange references to functions. So the $ symbol helps the parser separate the namespace.I don't have this problem in my parser. So my question is purely on readability and ease of use. I have coded for so many years in PHP that when I see $foo it's easy for me to identify this as a variable. Am I just giving a bias preference to this identifier?
Do sigils make source code easier to read?
programming languages;readability
The actual technical possibilites and limitations are nothing of the sort as are suggested throughout this thread. Let's clear out those first.Here's what $ is making possible in PHP:Variable variablesVariables with keyword name e.g. $return or being able to use same name for a variable and a functon/constant e.g. $__FILE__Limitations or features that are unrelated to the $ prefix:The implementation otherwise being unable to tell difference between functions and variablesPHP string interpolation or template syntaxRequired variable declarationThat means there is no technical reason you couldn't havefoo = something;echo foo;orfoo = something;echo foo = $foo;//would print//foo = something However you cannot have (assuming return is a keyword)return = something;Without serious complications. If you used a prefix like $, then it would not have been any problem.It's an opinion but I believe a sigil would be worth it for non programmers since it enables them to use keywordsas variable names, to them it would otherwise look like arbitrary limitation :P