How can JSON decoding be optimized for multiple values in PHP?

When decoding multiple JSON values in PHP, it is more efficient to decode the entire JSON string at once rather than decoding each value separately. This can be achieved by using `json_decode` with the second parameter set to `true` to decode the JSON string into an associative array. This way, you can access all the values in the array without having to repeatedly decode the JSON string.

$json = '{"key1": "value1", "key2": "value2", "key3": "value3"}';

$data = json_decode($json, true);

echo $data['key1']; // Output: value1
echo $data['key2']; // Output: value2
echo $data['key3']; // Output: value3