John W. Holmes wrote:

Have you seen Example 4 here: http://us2.php.net/manual/en/ref.simplexml.php

Not sure if that helps or not, though, but it looks like it's already an
associative array.

It certainly looks like an associative array, but the array_keys() function chokes on it:


Warning: array_keys() [function.array-keys]: The first argument should be an array in D:\...\test.php on line 5

Explicitely casting it as an array doesn't work either. I guess I want something like example 4, but without having to hardcode in the $rating['type']. Something more like:

foreach ($xml->movie[0]->rating as $rating) {
    foreach ($rating->attributes() as $key => $value) {
        if ($key == 'type') {
            switch ($rating['type']) {
                ...
            }
        }
    }
}

Thanks,
-Dan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to