rryqszq4 / php-cjson
Fast JSON parsing and encoding support for PHP extension
dev-master
2017-02-10 00:13 UTC
Requires
- php: >=5.3, <=5.6
This package is not auto-updated.
Last update: 2026-03-01 03:29:07 UTC
README
The php-cjson is a fast JSON parsing and encoding support for PHP extension.
Install
$/path/to/phpize
$./configure --with-php-config=/path/to/php-config
$make && make install
Example
encode
<?php $arr = array( 1, "string", array("key"=>"value") ); var_dump(cjson_encode($arr)); /* ==>output string(28) "[1,"string",{"key":"value"}]"; */ ?>
decode
<?php $str = '[1,"string",{"key":"value"}]'; var_dump(cjson_decode($str)); /* ==>output array(3) { [0]=> int(1) [1]=> string(6) "string" [2]=> array(1) { ["key"]=> string(5) "value" } } */ ?>