What function in PHP can be used to decode a JSON string?

To decode a JSON string 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. This allows you to easily work with JSON data in your PHP code.

$jsonString = '{"name": "John", "age": 30, "city": "New York"}';
$decodedData = json_decode($jsonString);

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