Re: Json.php
| From: | Tijnema ! | Date: | Mon, 16 Apr 2007 15:20:37 +0000 |
| Subject: | Re: Json.php | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-253014@lists.php.net to get a copy of this message | ||
On 4/16/07, Jochem Maas <jochem@iamjochem.com> wrote:
Otto Wyss wrote: Tijnema ! wrote:The class is called Services_JSON, not JSON. And btw, I think it's better not to create a new link to the class each time the function is called, but just use :: if (!function_exists('json_encode')) {This doesn't have a json_encode but needs a $json object which then could be used as $json->encode(...). Thanks anyway. that's going to make it completely impossible to use then isn't it. no way you could possibly wrap the class/objects functionality in a wrapper function. if (!function_exists('json_encode')) {*ROFLMFAO*...Did you actually try google for json.php? Second result: http://mike.teczno.com/JSON/JSON.phpsfunction json_encode($data) { $json = new JSON; // or whatever the class is called. return $json->encode($data); }}
function json_encode($data) {
return Services_JSON::encode($data);
}
}
and probably also one for decoding.
if (!function_exists('json_decode')) {
function json_decode($data) {
return Services_JSON::decode($data);
}
}
omg that was hard.Definitely not :) Tijnema