All pastes #278563 Raw Edit

JayandSilentBob

public text v1 · immutable
·published 2006-12-14 05:06 UTC
rendered paste body
function GetElementAttributes ($xml, $tag)
{
    if (false === ($startpos = strpos($xml, "<".$tag)))
    {
        return false;
    }
    $endpos = strpos($xml, ">", $startpos);
    $tag_data = substr($xml, $startpos, $endpos);
    $attributes = split(" ", $tag_data);
    for ($i=1; $i<count($attributes)-1; $i++)
    {
        list($key, $value) = split("=", $attributes[$i]);
        $return_list[$key] = trim($value, '"');
    }
    return $return_list;
}