Answers for "php get all values in json object"

PHP
5

php return json

header('Content-type: application/json');
echo json_encode($array);
Posted by: Guest on March-20-2020
0

php json request get value of an array element

<?php
$jsonurl = "https://reqres.in/api/users?page=2";
$json = file_get_contents($jsonurl);
$jsonDecode = json_decode($json, true);
var_dump($jsonDecode['data']);
foreach($jsonDecode['data'] as $mydata){
    echo $mydata['email'] . "<br>";
}
?>
Posted by: Guest on October-27-2020

Browse Popular Code Answers by Language