Since the json_encode function requires php5.20 or above to be supported, how can we use the json function if php does not support json_encode? Is there any alternative function? There is no alternative function. However, someone has made a custom php_json_encode. It is not known what problems will occur during use.
http://www.php.net/manual/zh /function.json-encode.php#74878
[php]
function php_json_encode($arr)
{
$json_str = "";
if(is_array($arr))
{
$pure_array = true;
$array_length = count($arr);
for($i=0;$i {
if(! isset($arr[$i]))
{
$pure_array = false;
break; 0;$i $temp[] = sprintf("%s", php_json_encode($arr[$i])); S}
else} {
$ json_Str = "{";
$ temp = array ();
Foreach ($ arr as $ key => $ value) {
$ temp [] = sprintf ; {
if(is_string($arr)) $json_str ;
}
Else
{
$ json_str = "" "" "" "" "" "" ";" ""; ""; "";
}
Return $ json_str;
}
Ternal_encoding ("UTF-8 ");
$convmap = array(0x80, 0xFFFF, 0, 0xFFFF);
$str = "";
for ($i = mb_strlen($in_str)-1; $i>=0; $i--) {
{
$str = sprintf("u%04x", $match[1]) . $str;
$str
[ /php]
json_encode alternative function php_json_encode