Convert array to json object in PHP

0
126
PHP

This tutorial explains how to convert array to json object in PHP.

<?php
$arr=array();
$arr['name'] = "SAM";
$arr['contact'] = 9874563210;
$arr['email'] = "example@domain.com";

$result_json = json_encode($arr);

echo $result_json;
?>

LEAVE A REPLY

Please enter your comment!
Please enter your name here