1

I'm a bit lost.

with print_r I get these results

stdClass Object ( [distlat] => 0 [distlng] => 0 [id] => 380 ) 

but how can echo the results?

like stdClass->distlat->$distlat ?

please give me a hint.

2 Answers 2

12

So,

echo $object->distlat;
echo $object->distlng;

doesn't work for you?

1
  • dunk now i wrote the same like you it thrown an error i copyed your and it works, weird, thanks for the help
    – Side
    Commented May 24, 2011 at 14:01
1

You are using print_r on a variable I guess, such $myVariable

To access the data of your object use :

echo $myVariable->distlat;
echo $myVariable->distlng;
echo $myVariable->id;

And try using var_dump instead of print_r. Information is a little completer with var_dump. (You have type information with it).

Not the answer you're looking for? Browse other questions tagged or ask your own question.