i have a php array
if(mysql_affected_rows() > 0)
{
$status = "OK";
while($row = mysql_fetch_array($result)) {
$info[] = array(
'postDate' => $row[1],
'vedioURL' => extractifrem($row[2]),
'like' => $row[3],
'totalView' => $row[4],
'viewTime' => $row[5]
);
}
$output = array(
'status' => $status,
'result' => $info
);
I want to print my result of $output as valid json readable.I am using this code but not work
$soutput = array();
foreach($output as $v) {
$soutput[key($v)] = current($v);
}
echo json_encode($soutput, 128);
echo json_encode($output, true);directly