I have an Object returned from the Facebook API and would like to "react" to the reactions of a post.
I have this snippet of code:
// Descodificando o JSON
$objeto = json_decode($userNode['reactions']);
// Percorrendo dados
foreach( $objeto as $tipo )
{
echo $tipo->type."<br />";
}
PS: var_dump($objeto);
array (size=6)
0 =>
object(stdClass)[115]
public 'id' => string '753855038121014' (length=15)
public 'name' => string 'Ivone Kodama' (length=12)
public 'type' => string 'LIKE' (length=4)
1 =>
object(stdClass)[113]
public 'id' => string '392780707772557' (length=15)
public 'name' => string 'Eunice Garcez' (length=13)
public 'type' => string 'LIKE' (length=4)
2 =>
object(stdClass)[114]
public 'id' => string '1355251021162174' (length=16)
public 'name' => string 'Gih Andrea Anastacio De Carvalho Baracat' (length=40)
public 'type' => string 'SAD' (length=3)
3 =>
object(stdClass)[54]
public 'id' => string '408046949554084' (length=15)
public 'name' => string 'Terezinha Piassa' (length=16)
public 'type' => string 'LIKE' (length=4)
4 =>
object(stdClass)[51]
public 'id' => string '194465404377613' (length=15)
public 'name' => string 'Sueli Aparecida' (length=15)
public 'type' => string 'LIKE' (length=4)
I get the following:
WOW
WOW
LIKE
LIKE
HAHA
WOW
LIKE
LIKE
SAD
LIKE
LIKE
HAHA
Etc ... How can I "know" how many times the word LIKE is repeated for example?