[PHP] Re: must I use var

2002-02-17 Thread Raymond Lilleodegard

Hi Peter!

The var $somevariable means that the variable is defined. You only need to
use var in classes. So if you only write ordinary scrpits, you dont need to
use it.

Regards Raymond

Peter J. Schoenster [EMAIL PROTECTED] wrote in message
3C6FC20B.3856.610F245@localhost">news:3C6FC20B.3856.610F245@localhost...
 HI,

 I was reading the docs and I see this:

  /* This is how it should be done. */
  class Cart
  {
  var $todays_date;
  var $name;
  var $owner;
  var $items;
 
  function Cart()
  {
  $this-todays_date = date(Y-m-d);
  $this-name = $GLOBALS['firstname'];
  /* etc. . . */
  }

 I don't see the point in doing

 var $todays_date;

 and

 $this-todays_date = date(Y-m-d);

 The latter works without the need for the var. Why should i use
 var?

 Thanks,

 Peter
 http://www.readbrazil.com/
 Answering Your Questions About Brazil



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: must I use var

2002-02-17 Thread Peter J. Schoenster

On 17 Feb 2002, at 23:20, Raymond Lilleodegard wrote:

 The var $somevariable means that the variable is defined. You only
 need to use var in classes. So if you only write ordinary scrpits, you
 dont need to use it.

Raymond,

Thanks. Someone else said it just helped to see what your class 
variables where (but I can see this easily enough).

I don't NEED to use var even in classes. I'm writing a class right 
now without it. But perhaps there is a SHOULD that I am not aware 
of (just helping me see .. well I don't need that).

Peter
http://www.readbrazil.com/
Answering Your Questions About Brazil

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php