Encode PHP constructs to JSON
category | Zend |
---|---|
package | Zend_Json |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
encode(mixed $value, boolean $cycleCheck= false
, array $options= array()
) : string
mixed
The value to be encoded
boolean
Whether or not to check for possible object recursion when encoding
array
Additional options used during encoding
string
The encoded valueencodeClass(string $className, string $package = ''
) : string
NOTE: Currently only public methods and variables are proxied onto the client machine
string
The name of the class, the class must be instantiable using a null constructor
string
Optional package name appended to JavaScript proxy class name
\Zend_Json_Exception |
---|
string
The class2 (JavaScript) encoding of the classencodeClasses(array $classNames, string $package = ''
) : string
Returns JSON encoded classes, using \encodeClass().
array
string
string
encodeUnicodeString(string $value) : string
This algorithm was originally developed for the Solar Framework by Paul M. Jones
link | http://solarphp.com/ |
---|---|
link | http://svn.solarphp.com/core/trunk/Solar/Json.php |
string
string
__construct(boolean $cycleCheck= false
, array $options= array()
) : void
boolean
Whether or not to check for recursion when encoding
array
Additional options used during encoding
_encodeArray(\array& $array) : string
Recursively encodes each value of an array and returns a JSON encoded array string.
Arrays are defined as integer-indexed arrays starting at index 0, where the last index is (count($array) -1); any deviation from that is considered an associative array, and will be encoded as such.
\array&
string
_encodeDatum(\mixed& $value) : string
If value type is not a string, number, boolean, or null, the string 'null' is returned.
\mixed&
string
_encodeObject(object $value) : string
A special property is added to the JSON object called '__className' that contains the name of the class of $value. This is used to decode the object on the client into a specific class.
object
\Zend_Json_Exception |
If recursive checks are enabled and the object has been serialized previously |
---|
string
_encodeString($string) : string
string
_encodeValue(mixed $value) : string
mixed
The value to be encoded
string
Encoded value_utf82utf16(string $utf8) : string
Normally should be handled by mb_convert_encoding, but provides a slower PHP-only method for installations that lack the multibye string extension.
This method is from the Solar Framework by Paul M. Jones
link | http://solarphp.com |
---|
string
UTF-8 character
string
UTF-16 character_wasVisited(mixed $value) : boolean
mixed
boolean
_encodeConstants(\ReflectionClass $cls) : string
\ReflectionClass
string
Encoded constant block in class2 format_encodeMethods(\ReflectionClass $cls) : string
\ReflectionClass
string
Encoded method fragment_encodeVariables(\ReflectionClass $cls) : string
\ReflectionClass
string
Encode properties list$_cycleCheck : boolean
$_visited : array
array()