/** * "private static" method, * choose json core function or Pear Service to encode */ function __encode($input) { if (function_exists('json_encode')) { $result = json_encode($input); } else { require_once 'JSON.php'; $json = new Services_JSON(); $result = $json->encode($input); } return JSON::__rawjsonconvert($result); }