rksh
rksh

Reputation: 4050

PHP : Getting Data From An Array

I got a set of data that looks like this

 { [0]=> object(stdClass)#5 (19) { ["text"]=> string(39) "So true! :(" } object(stdClass)#5 (19) { ["text"]=> string(39) "Some other text"}

I tried this but it's not returning any data

$content->{0}->text;  
$content->{1}->text;

how to get this data? it's not returning any

Upvotes: 1

Views: 54

Answers (1)

Zbigniew
Zbigniew

Reputation: 27594

Those are objects inside array, you can access them like this:

$content[0]->text

Upvotes: 3

Related Questions