June 2015
Intermediate to advanced
192 pages
4h 8m
English
PHP is a popular server-side scripting environment easily integrated with the Apache and Microsoft IIS web servers. It has native support for simple JSON encoding and decoding.
PHP provides two functions, json_encode and json_decode, to encode and decode JSON respectively.
You can pass primitive types or user-defined classes to json_encode and it returns a string containing the JSON representing the object. For example:
$result = array( "call" =>"KF6GPE", "type" =>"l", "time" =>"1399371514", "lasttime" =>"1418597513", "lat" =>37.17667, "lng" =>-122.14650, "result" =>"ok"); $json = json_encode($result);
This creates a string $json containing the JSON representation of our associative array.
The json_encode ...
Read now
Unlock full access