dollars and sense.

php.internals

Michael Hawley

22 years ago
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

Andrei Zmievski

22 years ago
On Mon, 26 Jan 2004, Michael Hawley wrote:
> 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)

Brad LaFountain

22 years ago
hahahhaha --- Andrei Zmievski <andrei@gravitonic.com> wrote:
> On Mon, 26 Jan 2004, Michael Hawley wrote: > > 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) > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >
__________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/

Ken Tossell

22 years ago
On Mon, 26 Jan 2004, Michael Hawley wrote:
> 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:)

Christian Schneider

22 years ago
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

Cesare D'Amico

22 years ago
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

Andrei Zmievski

22 years ago
On Tue, 27 Jan 2004, Christian Schneider wrote:
> Why do you say this? I prefer "foo $bar blah".
Because it's faster. - Andrei

Christian Schneider

22 years ago
Andrei Zmievski wrote:
> On Tue, 27 Jan 2004, Christian Schneider 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

Sterling Hughes

22 years ago
> Andrei Zmievski wrote: > >On Tue, 27 Jan 2004, Christian Schneider 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