PHP Classes

File: examples/example_encode.php

Recommend this page to a friend!
  Classes of Jorge Castro   Services_JSON   examples/example_encode.php   Download  
File: examples/example_encode.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Services_JSON
Pure PHP implementation of JSON encode and decode
Author: By
Last change:
Date: 1 year ago
Size: 375 bytes
 

Contents

Class file image Download
<?php

use eftec\ServicesJson\Services_JSON;

include
'../vendor/autoload.php';



$array=["hello"=>['a'=>2,'b'=>3],'world'=>[1,2,3,"aaa","bbb"]];

$obj=(object)$array;

echo
"Encode array to json<br>";
echo
"<pre>";
var_dump(Services_JSON::encode($array));
echo
"</pre>";
echo
"Encode object to json<br>";
echo
"<pre>";
var_dump(Services_JSON::encode($obj));
echo
"</pre>";