PHP code example of eastwest / json
1. Go to this page and download the library: Download eastwest/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/ */
eastwest / json example snippets
use Eastwest\Json\Json;
use Eastwest\Json\JsonException;
try {
$json = Json::encode(['key' => 'value']);
} catch (JsonException $e) {
// code and message will match json_last_error() values:
// @link http://php.net/manual/en/function.json-last-error.php#refsect1-function.json-last-error-returnvalues
echo $e->getMessage();
echo $e->getCode();
}