added function json_encode to support php4