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]
|