æøå in json_encode()

seeker

New Member
how can it be that strings containing ??? or other special chars is returned as null?? not only the special char is leaved but the whole string (value) is returned as null...EDIT:\[code\]class JSON { static function encode($arr, $utf8_encode=false){ $arr = self::parse_int($arr); if($utf8_encode){ array_walk_recursive($arr, array(self => 'utf8_enc')); } return $arr ? json_encode($arr):'{}'; } static function decode($str){ return json_decode($str, true); } function utf8_enc(&$value, $key){ $value = http://stackoverflow.com/questions/5779309/utf8_encode($value); } function parse_int($arr){ foreach($arr as $key => $value){ if(is_array($value)){ $arr[$key] = self::parse_int($value); } else{ if(is_numeric($value)){ settype($value,'float'); } $arr[$key] = $value; } } return $arr; }}\[/code\]but I get this error:\[code\]Warning: array_walk_recursive() expects parameter 2 to be a valid callback, array must have exactly two members\[/code\]in this line:\[code\]array_walk_recursive($arr, array(self => 'utf8_enc'));\[/code\]how do you define a function in the current object?
 
Top