Reply to Re: Basic PHP4 Class question

Your name:

Reply:


Posted by Andy Hassall on 12/20/06 21:35

On 20 Dec 2006 08:25:58 -0800, "Aggelos" <djjelly@gmail.com> wrote:

>if i have the folowing class:
>
>class person {
> var $name;
> var $surname;
> var $flag;
> function person($name=NULL,$surname=NULL) {
> $this->name = $name;
> $this->surname = $surname;
> $this->flag = 1;
> }
> function displayPerson($person) {
> print_r($person);
> }
>}
>
>I can do the folowing without instantiating the class :
>$person = new person('Fred','Jones');
>person::displayPerson($person);
>
>is there anyway to access the $flag variable in the contructor without
>having to do $person = new person() ?
>
>Something like echo person::$flag; ? <------- I know that this is not
>right. I am just asking if there is something simmilar tha I can do.

I don't quite understand what you're asking; the closest might be static
properties?

http://www.php.net/manual/en/language.oop5.static.php

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

[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

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