The sigil for a variable in php is part of how the system works. It conveys some information for the parser about what the thing actually is. By keeping the variables and the functions in completely different name spaces, it allows one to have variable names that are function names without collision.
The without collision bit is kind of important in php, since it has been known to have quite a few standard functions. This is further complicated but he fact that parentheses for functions are optional. The parentheses are part of how other languages without sigils often separate if the identifier is a value or a function.
int foo() { return 42; }
int foo = 42;
int bar;
bar = foo;
bar = foo();
In Java, (the code above) there is no ambiguity about which foo
is being used in each line because the ()
are required on function calls.
This is not the case in php.
$echo = "foo";
echo $echo;
echo($echo);
Both of those are perfectly valid. It is the sigil that says that one echo is a function call and the other is a variable.
So, no, the sigil for a variable cannot be made optional in php. It is part of the type system and identifier lookup and parser. It conveys necessary information that allows other things to be optional (like parentheses).
For fun, consider the following code (ideone) and the impact that sigils have on first class functions:
function greet($arg) { return "Hello $arg\n"; }
$greet = function($arg) { return "Greetings $arg\n"; };
echo $greet("Everyone");
echo greet("World");
And while there are ways of working around this in other languages that lack sigils that have first class functions, the combination of sigils and anonymous functions can be seen as making things a bit easier on the programmer and on the language designer at the same time.