note 89521 added to function.json-encode
| From: | korean at osu1 dot php dot net | Date: | Thu, 12 Mar 2009 11:02:42 +0000 |
| Subject: | note 89521 added to function.json-encode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151760@lists.php.net to get a copy of this message | ||
#json_encode php 5.2 <<
function JSON_print($result, $child = false)
{
foreach($result as $key => $val)
{
$is_child = 0;
if(is_array($val)){ $AjaxReturn[] = JSON_print($val,true); $is_child++;}
else $AjaxReturn[] = '\'' . $key . '\' : \'' .
$val.'\'';
}
$return_json = $is_child > 0? '['.implode(', ',$AjaxReturn).']' :
'{'.implode(', ',$AjaxReturn).'}';
if($child) return $return_json;
else print $return_json;
exit;
}
----
Server IP: 211.43.210.124
Probable Submitter: 119.198.28.133
----
Manual Page -- http://www.php.net/manual/en/function.json-encode.php
Edit -- https://master.php.net/note/edit/89521
Del: integrated -- https://master.php.net/note/delete/89521/integrated
Del: useless -- https://master.php.net/note/delete/89521/useless
Del: bad code -- https://master.php.net/note/delete/89521/bad+code
Del: spam -- https://master.php.net/note/delete/89521/spam
Del: non-english -- https://master.php.net/note/delete/89521/non-english
Del: in docs -- https://master.php.net/note/delete/89521/in+docs
Del: other reasons-- https://master.php.net/note/delete/89521
Reject -- https://master.php.net/note/reject/89521
Search -- https://master.php.net/manage/user-notes.php