What are some potential pitfalls when trying to match attributes and attribute values in SimpleXML in PHP?

One potential pitfall when trying to match attributes and attribute values in SimpleXML in PHP is not properly accessing the attribute values using the correct syntax. To avoid this issue, make sure to use the `->attributes()` method to access attributes and their values.

$xml = '<bookstore>
            <book category="fiction">
                <title>Harry Potter</title>
            </book>
        </bookstore>';

$books = simplexml_load_string($xml);

foreach ($books->book as $book) {
    $category = $book->attributes()['category'];
    echo "Category: " . $category . "\n";
}