/ Published in: PHP
URL: http://usphp.com/manual/en/function.json-encode.php#82904
Credits go to Steve at the URL shown
Expand |
Embed | Plain Text
{ function json_encode($a=false) { if ($a === false) return 'false'; if ($a === true) return 'true'; { { // Always use "." for floats. } { } else return $a; } $isList = true; { { $isList = false; break; } } if ($isList) { foreach ($a as $v) $result[] = json_encode($v); } else { foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v); } } }
You need to login to post a comment.
