Jump to content

Accessing element of object array


BahBah

Recommended Posts

Hello

 

My object looks like this:

 

Array ( [0] => User Object ( [id] => [username] => [password] => [title] => [firstname] => [surname] => [email] => [active] => [salt] => M}8 ) )

 

This is the result of a SQL method from my SQL class.

 

$result_array = self::find_by_sql($sql);

 

Can you please tell me how I can access the 'salt' element of the object array above ? I've been trying:

 

$result_array->salt

 

but that doesn't work.

 

Thanks for any assistance.

Link to comment
https://forums.phpfreaks.com/topic/186299-accessing-element-of-object-array/
Share on other sites

Here's the var_dump:

 

array(1) { [0]=>  object(User)#4 (9) { ["id"]=>  NULL ["username"]=>  NULL ["password"]=>  NULL ["title"]=>  NULL ["firstname"]=>  NULL ["surname"]=>  NULL ["email"]=>  NULL ["active"]=>  NULL ["salt"]=>  string(3) "M}8" } }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.