facebook

LEARN ABOUT JSON ENCODE AND DECODE IN PHP

By Anwesha Chakraborty

LEARN ABOUT JSON ENCODE AND DECODE IN PHP

JSON is basically used when we want to send back data to the client server. JSON ENCODE means if the data type is in array format then it actually turns into JSON OBJECT, and JSON DECODE is vice versa to the JSON encode.

here I can show you a small example of JSON ENCODE

$data = array(
    ‘name’ => ‘anwesha’,
    ‘gender’ => ‘Female’,
  ‘address’=>’agarpara’
);
$json = json_encode($data);
this way $data which is array datatype turns into JSON object
here is also one small example of JSON  DECODE
$json = “{ ‘anwesha’: ‘Female‘ }”;
json_decode(json);
in this way $json turns into json array.

Anwesha Chakraborty Subscriber
Web Developer , Openweb Solutions

Web Developer at Openweb Solutions

Posts created 1

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top
shares