What function in PHP can be used to decode JSON data?

To decode JSON data in PHP, you can use the `json_decode()` function. This function takes a JSON string as input and returns a PHP variable (array or object) representing the decoded data. It is useful when you need to work with JSON data retrieved from an API or stored in a file.

// JSON data to decode
$jsonData = '{"name": "John", "age": 30, "city": "New York"}';

// Decode JSON data
$decodedData = json_decode($jsonData);

// Access decoded data
echo $decodedData->name; // Output: John
echo $decodedData->age; // Output: 30
echo $decodedData->city; // Output: New York