so i have a function that creates objects (with member variables) and pushes those objects onto the array. after adding all of the objects, the function then returns the array...

i'm having trouble accessing the members of each object in the array...i'm trying to do something like this:

class Object {
        var $id;
        function Object($param) {
                $this->id = $param;
        }
}

function getArrayOfObjects() {
        $theArray = array();
        for ($i = 0; $i < 10; $i++) {
                $theArray[] = new Objects($i);
        }
        return $theArray;
}

$temp = getArrayOfObjects();
echo $temp[0]->id;   // this should display "0"

do i have to do something with references or dereference the id variable some other way? i'm coming from java where something like this is extremely easy...

thanks
amit


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



Reply via email to