How can the json_decode function in PHP impact the way data is accessed from an array?

When using the `json_decode` function in PHP to convert a JSON string into an array, the data may be accessed differently than when working with a regular PHP array. This is because `json_decode` returns an object by default, which requires accessing elements using the arrow operator (->) instead of square brackets ([]). To access the data as an array, you can pass `true` as the second argument to `json_decode`.

$jsonString = '{"name": "John", "age": 30}';
$arrayData = json_decode($jsonString, true);

// Accessing data as an array
echo $arrayData['name']; // Output: John
echo $arrayData['age']; // Output: 30