Home » PHP JSON

PHP JSON

PHP allows us to encode and decode JSON by the help of json_encode() and json_decode functions.

1) PHP json_encode

The json_encode() function returns the JSON representation of a value. In other words, it converts PHP variable (containing array) into JSON.

Syntax:

PHP json_encode example 1

Let’s see the example to encode JSON.

You may also like