obj in array?

obj in array?

am 24.02.2010 14:02:40 von Kim Madsen

Hi folks

I'm hacking on a SOAP2 solution towards Magento and have retrieved the
catalog in an array, but i'm having trouble accessing the values of the
array cause there's an object in it. This is a var_dump of $my_array:

array(14) {
[0]=>
object(stdClass)#2 (2) {
["set_id"]=>
int(44)
["name"]=>
string(7) "Cameras"
}
[1]=>
object(stdClass)#3 (2) {
["set_id"]=>
int(38)
["name"]=>
string(11) "Cell Phones"
}

how do I access for instance set_id in $my_array[0]? I tried declaring
an instance of $my_array[0] but that fails too: "Fatal error: Cannot use
object of type stdClass as array "

--
Kind regards
Kim Emax - masterminds.dk

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

Re: obj in array?

am 24.02.2010 14:08:16 von Kim Madsen

Kim Madsen wrote on 24/02/2010 14:02:

> how do I access for instance set_id in $my_array[0]? I tried declaring
> an instance of $my_array[0] but that fails too: "Fatal error: Cannot use
> object of type stdClass as array "

$my_array[0]->set_id; did the trick


--
Kind regards
Kim Emax - masterminds.dk

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