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, but someone has made a custom php_json_encode. It is not known what problems will occur during use.
[php]
function php_json_encode($arr)
{
$ json_str = "";
if(is_array($arr))
{
$pure_array = true;
$array_length = count($arr);
for($i=0;$i<$array_length;$i++)
{
{
array();
for($i=0;$i<$array_length;$i++)
{
$temp[] = sprintf("%s", php_json_encode($arr[$i]));
}
$json_str .= implode(",",$temp);
$json_str foreach($arr as $ key = & gt; $ value) {
$ Temp [] = sprintf (""%s ":%s", $ key, php_json_encode ($ value));
}
$ json_Str. ",$temp);
$json_str .="}";
}
}
else
{
if(is_string($arr))
{
$json_str = """. $arr) . "" ";
_string($arr) . """;
}
}
return $json_str;
}
function json_encode_string($in_str) {
mb_internal_encoding("UTF-8");
$convmap = array(0x80, 0xFFFF, 0, 0xFFFF);
$str = "";
for ($i = mb_strlen($in_str)-1; $i>=0; $i--) {
$mb_char = mb_substr($in_str, $i, 1);
;
$str = $mb_char .