RE: Why $ on variable names?
| From: | Philip Hallstrom | Date: | Tue, 12 Nov 2002 19:08:30 +0000 |
| Subject: | RE: Why $ on variable names? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124052@lists.php.net to get a copy of this message | ||
It could have, but what does "array" consist of below?
variable = "foo";
array[variable] = variable;
Is it "variable" => "variable", or "foo" => "foo" or
"variable" => "foo"
or ? By using $ you keep things simpler... at least to me :)
-philip
On Tue, 12 Nov 2002, brucedickey wrote:
> Thanks for all the replies.
>
> I just seemed to me that to add $ everywhere was more work (and not as
> aesthetic as a plain word) than using some other syntax for print. But, in
> fact, it could have been designed so you could still use
>
> print "I'm a $variable";
>
> without the use of $ in other uses of the variable (like in assignments and
> references to it), right? Rhetorical question.
>
> (Just an initial impression of PHP)...
>
> Bruce
>
>
> -----Original Message-----
> From: Jason Wong [mailto:php-general@gremlins.com.hk]
> Sent: Tuesday, November 12, 2002 11:40 AM
> To: php-general@lists.php.net
> Subject: Re: Why $ on variable names?
>
>
> On Wednesday 13 November 2002 02:35, Leif K-Brooks wrote:
> > I'm just guessing here. For one thing, to seperate variables from
> > constants. Also, it makes it possible to use variables within quotes.
>
> Yup. So you can have:
>
> print "I'm a $variable";
>
> instead of the messy javascript way:
>
> alert("I'm a " . $variable);
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Aleph-null bottles of beer on the wall,
> Aleph-null bottles of beer,
> You take one down, and pass it around,
> Aleph-null bottles of beer on the wall.
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>