What is the purpose of the json_encode() function in PHP?

  • To encode a PHP object into a JSON string
  • To decode a JSON string into a PHP object
  • To encode a PHP object into a serialized string
  • To decode a serialized string into a PHP object
The json_encode() function in PHP is used to encode a PHP object or array into a JSON string. JSON is a popular data interchange format, and this function allows you to convert PHP data into a JSON format that can be easily transmitted or stored. Learn more: http://php.net/manual/en/function.json-encode.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *