Answers for "print prttey json string php"

PHP
5

php echo json

<?php
$data = ['name' => 'John', 'age' => 35];
header('Content-type: Application/json');
echo json_encode($data);
Posted by: Guest on September-25-2020
0

php parse json

// scrap this:
$data = json_decode($rawdata);

// use this:
$data = json_decode($rawdata, true);
echo $data["key1"];
Posted by: Guest on March-03-2022

Browse Popular Code Answers by Language