json_encode()` function. Here is an example program that demonstrates how to encode an associative array into a JSON object :<?php
// Sample associative array
$data = array(
    'name' => 'John Doe',
    'age' => 30,
    'email' => 'johndoe@example.com'
);
// Encode the array into a JSON object
$json = json_encode($data);
// Output the JSON object
echo $json;
?>{"name":"John Doe","age":30,"email":"johndoe@example.com"}json_encode()` function is used to encode the associative array `$data` into a JSON object. The resulting JSON object is then stored in the variable `$json`. Finally, the program outputs the JSON object using the `echo` statement.