1. Go to this page and download the library: Download phputil/json library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
phputil / json example snippets
\phputil\JSON;
class Foo {
private $a = 1;
protected $b = 2;
public $c = 3;
function getA() { return $this->a; }
function getB() { return $this->b; }
function getC() { return $this->c; }
}
echo JSON::encode( new Foo() ); // { "a": 1, "b": 2, "c": 3 }