php-general | 2005051
Date: 05/05/05
- Next message: Anasta: "[PHP] select statement"
- Previous message: Joe Wollard: "Re: [PHP] control-M"
- In reply to: Jon M.: "[PHP] Re: [suspicious - maybe spam] Re: [suspicious - maybe spam] [PHP] Simple question: How to declareVars in PHP? (I know it's not necessary, but I still want to know)"
- Next in thread: bala chandar: "[PHP] [suspicious - maybe spam] Re: [suspicious - maybe spam] [PHP] Simple question: How to declare Vars in PHP? (I know it's not necessary, but I still want to know)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
hi,
On 5/5/05, Jon M. <dsak8330225 <email protected>> wrote:
> Oops!! What I meant was:
>
> JavaScript:
>
> var varName;
>
> PHP:
>
> var $varName;
>
> I can't believe I did that (I have been writing JavaScript for a few years,
> and know better -I gotta get more sleep).
>
> So, are you saying that it is absolutely "PHP-illegal" to do:
>
> var $varName;
>
> in PHP??? Would it be ignored? Or would it screw up the interpreter?
Yes. I checked for var $i = 1; it throwed parse error. so i think you cannot do.
>
> "Rasmus Lerdorf" <rasmus <email protected>> wrote in message
> news:4279895C.9010407 <email protected>
> > Jon M. wrote:
> >> I know in JavaScript, that you declare vars like so:
> >>
> >> var = variableName;
> >>
> >> So I'm assuming that in PHP you do it like this:
> >>
> >> var = $variableName;
> >>
> >> But there doesn't seem to be a single shred of documentation on PHP.net
> >> (or
> >> in ANY book) that covers this. All they say is that it's good practice,
> >> but
> >> not necessary. Then they always skip telling you how.
> >>
> >> I always like to declare vars since it helps me keep track of the vars I
> >> will be using, and I just like to do things right.
> >>
> >> So am I right about how you do it? "Yes", "No", example please??
> >
> > No
> >
> > You don't declare variables in PHP. You just start using them.
> >
> > Perhaps you mean assign? Since your example of
> >
> > var = variableName;
> >
> > is actually an assignment in Javascript.
> >
> > In PHP you simply do:
> >
> > $one_var = $another_var;
> >
> > -Rasmus
>
-- bala> balachandar muruganantham blog> lynx http://chandar.blogspot.com web> http://www.chennaishopping.com-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Anasta: "[PHP] select statement"
- Previous message: Joe Wollard: "Re: [PHP] control-M"
- In reply to: Jon M.: "[PHP] Re: [suspicious - maybe spam] Re: [suspicious - maybe spam] [PHP] Simple question: How to declareVars in PHP? (I know it's not necessary, but I still want to know)"
- Next in thread: bala chandar: "[PHP] [suspicious - maybe spam] Re: [suspicious - maybe spam] [PHP] Simple question: How to declare Vars in PHP? (I know it's not necessary, but I still want to know)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

