1
Friends, in the code below I do the following:
$term = '422';
$data = json_decode($response);
$filtered = array_filter($data, function($item) use ($term) {
return stripos($item->id, $term) !== false;
});
print_r($filtered);
And then I have this return below:
Array ( [0] => stdClass Object ( [id] => 422 [filial] => 4 [name] =>
COD. 069 30 Mb TRANSPORTE [nome_amigavel] => 30 Mb [mensalidade] =>
1500.00 [desconto] => 0.00 [ativo] => 1 [tipo] => 3 [instalacao] =>
1500.00 [bnd_up] => 0 [bnd_down] => 30000 ) )
How would I get it out of that return with an echo or print only ONE information !? example : 30 Mb
$Filtered[0]->friend_name
– Felipe Duarte
rs. Simple , Thanks Felipe !!!!
– Joao Vasco
It would be possible to pick otherwise than by the array number [0] ! ?
– Joao Vasco
Using
reset
:reset($filtered)->nome_amigavel
– Marcelo de Andrade
Thanks Marcelo, worked well !!!!
– Joao Vasco