Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP: Getting data out of an object

Tags:

object

php

How can I get the 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 learn this?

like image 250
christina Avatar asked Dec 08 '10 21:12

christina


2 Answers

$variable->data->user_nicename

should work.

like image 156
Pekka Avatar answered Oct 08 '22 07:10

Pekka


You can print by another way also

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
like image 36
Shiv Singh Avatar answered Oct 08 '22 07:10

Shiv Singh