rryqszq4/php-cjson

Fast JSON parsing and encoding support for PHP extension

dev-master 2017-02-10 00:13 UTC

This package is not auto-updated.

Last update: 2024-04-27 17:09:13 UTC


README

Build Status

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"
  }
}
*/
?>