You can use this function : get_object_vars to retreive vars from a class..

Here is the example from phpdoc :
<?php
class Point2D {
    var $x, $y;
    var $name;
    function Point2D($x, $y) {
        $this->x = $x;
        $this->y = $y;
    }
    function setName($name) {
        $this->name = $name;
    }
    function ReadPoint() {
        return array("x" -> $this->x,
                     "y" -> $this->y,
                     "name" -> $this->name);
    }
}
$p1 = new Point2D(1.233, 3.445);
print_r(get_object_vars($p1));
// "$nom" is declard but undefined
// Array
// (
//     [x] -> 1.233
//     [y] -> 3.445
// )
$p1->setName("point #1");
print_r(get_object_vars($p1));
// Array
// (
//     [x] -> 1.233
//     [y] -> 3.445
//     [name] -> point #1
// )
?>"Christophe Barbe" <[EMAIL PROTECTED]> a écrit dans le message de
news: [EMAIL PROTECTED]
> I guess the answer is obvious but can't find it in the manual.
>
> Is it possible to have a variable in a class that is shared by all
> instances. I thought 'static' would do it but apparently not.
>
> Christophe
>
> --
> Christophe Barbé <[EMAIL PROTECTED]>
> GnuPG FingerPrint: E0F6 FADF 2A5C F072 6AF8  F67A 8F45 2F1E D72C B41E
>
> Dogs believe they are human. Cats believe they are God.



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

Reply via email to