Why must variable names begin with $? I can't see any
real reason, except when signalling a replacement within
a string (e.g., "... $var ..."). The language would be less
cumbersome if the dollar was optional otherwise.
Mike
Why must variable names begin with $? I can't see any
real reason, except when signalling a replacement within
a string (e.g., "... $var ..."). The language would be less
cumbersome if the dollar was optional otherwise.
You are about 9 years late to the party.
-Andrei
"Claiming Java is easier than C++ is like
saying that K2 is shorter than Everest."
-- Larry O'Brien (editor, Software Development)
Why must variable names begin with $? I can't see any
real reason, except when signalling a replacement within
a string (e.g., "... $var ..."). The language would be less
cumbersome if the dollar was optional otherwise.
Two letters: HA
But to answer your question based on current PHP, non-prefixed variables
would conflict with define()
d constants, which appear as: $foo =
'abc'.bar;
Ken
ps: sorry, but... heh...
pps: don't use "foo $bar blah" -- use 'foo ' . $bar . ' blah'; or commas:)
Ken Tossell wrote:
pps: don't use "foo $bar blah" -- use 'foo ' . $bar . ' blah'; or commas:)
Why do you say this? I prefer "foo $bar blah".
- Chris
Alle 11:11, martedì 27 gennaio 2004, Christian Schneider ha scritto:
Ken Tossell wrote:
pps: don't use "foo $bar blah" -- use 'foo ' . $bar . ' blah'; or
commas:)Why do you say this? I prefer "foo $bar blah".
...let the holy war begin...
;-)
--
Cesare D'Amico - boss (@t) cesaredamico (dot) com
http://www.cesaredamico.com ~ http://www.phpday.it
Il segreto di volare consiste nel gettarti a terra, e sbagliare.
-- Douglas Adams
Why do you say this? I prefer "foo $bar blah".
Because it's faster.
- Andrei
Andrei Zmievski wrote:
Why do you say this? I prefer "foo $bar blah".
Because it's faster.
Ok, that's interesting but irrelevant for most of my code. Readability
is a higher priority in most cases.
Thanks for pointing this out,
- Chris
Andrei Zmievski wrote:
Why do you say this? I prefer "foo $bar blah".
Because it's faster.
Ok, that's interesting but irrelevant for most of my code. Readability
is a higher priority in most cases.Thanks for pointing this out,
If you use a compiler cache like apc, this performance hit will be
totally removed as the optimizer compiles both representations into the
same format.
-sterling
--
"Reductionists like to take things apart. The rest of us are
just trying to get it together."
- Larry Wall, Programming Perl, 3rd Edition