Reply to Fwd: [PHP] Re: How do you declare Vars in PHP? -I know it's not necessary, but I still want to know

Your name:

Reply:


Posted by Rory Browne on 05/05/05 14:10

Otherwise you can 'declare' them by assigning them a null/zero/empty value.

$my_number = 0;
$my_string = ""
$my_array = array();

The main reason for 'declaring' variables in PHP, is so that you can
use them in functions without raising an E_NOTICE.


On 5/5/05, Ryan Faricy <ryan@faricy.net> wrote:
>
> "Jon M." <dsak8330225@yahoo.com> wrote in message
> news:20050505050642.9114.qmail@lists.php.net...
> >I just found a place here:
> >
> > http://us2.php.net/manual/en/language.oop.php
> >
> > That has this example:
> >
> > /* This is how it should be done. */
> > class Cart {
> > var $todays_date;
> > var $name;
> > var $owner;
> > var $items = array("VCR", "TV");
> >
> > function Cart() {
> > $this->todays_date = date("Y-m-d");
> > $this->name = $GLOBALS['firstname'];
> > /* etc. . . */
> > }
> > }
> >
> > It appears that they are declaring vars like this:
> >
> > var $todays_date;
> >
> >
> > Is this something you can only do inside a class???
>
> Yes, as has been said within this thread several times.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация