PHP: getting data from an object

How can I get user_nicename from this object?

 BP_User Object ( [data] => stdClass Object ( [ID] => 1 [user_login] => NICENICE [user_pass] => $P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5. [user_nicename] => NICENAME ... 

And where can I find resources to find out?

+6
object php
source share
2 answers
 $variable->data->user_nicename 

must work.

+23
source share

You can print in a different way as well.

 foreach($result->data as $newdata) //$result is variable that store raw data { printf("name: %s, Pass: %s, nicename: %s <br/>", $newdata->user_login, $newdata->user_pass, $newdata->user_nicename); } 

Result will be

 name:NICENICE , Pass:$P$BwLHvV7zxcZZ/zW7MY0NXNSmANP.U5., nicename:NICENAME 
+3
source share

All Articles