-1

I have some object like this :

object(stdClass)#188 (1) { ["0"]=> string(1) "1" }

How could I print that object value in php ?

Thank you.

Nicholas
  • 119
  • 2
  • 17
  • use var_dump()... – RJParikh Oct 28 '16 at 05:00
  • 2
    If you type that exact question into google. You get multiple answers.Here is the [first one](http://stackoverflow.com/questions/11231638/get-values-stdclass-object-php) and it answers your question. – Luke Oct 28 '16 at 05:01

3 Answers3

1

Very short answer

var_dump($obj->{'0'});
Deep
  • 2,472
  • 2
  • 15
  • 25
1

Try this, Best way for single value

echo $objects->{"0"};

and for multiple values

foreach($objects as $val )
{
    echo $val;
}
Dave
  • 3,073
  • 7
  • 20
  • 33
0

You have access to the internal content of the Object via: ->{"0"}. Assuming you want to use the variable or echo it out for some reasons, you can simply do:

 <?php echo $object->{"0"}; ?>
Poiz
  • 7,611
  • 2
  • 15
  • 17