Answers for "print the json 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
1

php return json data

header('Content-Type: application/json'); 

$colors = array("red","blue","green");
echo json_encode($colors);
Posted by: Guest on October-30-2019

Browse Popular Code Answers by Language