RSS

Convert Array to Json format using PHP

19 វិច្ឆិកា

I have an array:

$arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);

// show the format
echo json_encode($arr);
?>

the return will be:

{"a":1,"b":2,"c":3,"d":4,"e":5}

 
បញ្ចេញមតិ

បានចុះផ្សាយដោយ ៖ ​នៅ ខែវិច្ឆិកា 19, 2011 in ចែករំលែក, PHP

 

បញ្ចេញមតិ

 
Design a site like this with WordPress.com
Get started