I make a function and use http:get in order to fetch from an api, but as it is associative array it is hard to reach end of element such as title, how can solve it?
<?php
namespace AppHttpControllers;
use IlluminateSupportFacadesHttp;
use IlluminateHttpRequest;
class apiTest extends Controller
{
function data()
{
$get = http::get('https://jsonplaceholder.typicode.com/posts');
$data = $get ->json();
foreach ($data as $key => $datas) {
foreach ($datas as $key => $value){
echo $value;
}
}
}
}