Parsing An RSS Feed For All Post Titles
Join the DZone community and get the full member experience.
Join For Free// description of your code here
http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-for-breakfast/
PHP:
function xmltoArray($node)
{
$array = array();
foreach ($node->children as $child)
{
if (empty($child->children))
{
$value = $child->value;
}
else
{
$value = xmltoArray($child);
}
$key = $child->name;
if (!isset($array[$key]))
{
$array[$key] = $value;
}
else
{
if (!is_array($array[$key]) || !isset($array[$key][0]))
{
$array[$key] = array($array[$key]);
}
$array[$key][] = $value;
}
}
return $array;
}
POST (HTTP)
Opinions expressed by DZone contributors are their own.
Comments