Return to Snippet

Revision: 15887
at July 20, 2009 12:14 by iloveitaly


Initial Code
function set_simplexml_attributes($element, $attributes) {
	foreach($attributes as $key => $value) {
		$element->addAttribute($key, $value);
	}
}

// ex:
set_simplexml_attributes($categoryElement, array(
				"id" => "1",
				"enabled" => "true",
				"iconUrl" => $this->thinger,
				"tooltip" => "popups/study.swf"
));

Initial URL

                                

Initial Description
Convenience function to set a SimpleXMLElement's attributes quickly.

Initial Title
SimpleXML Set Attributes

Initial Tags
array, xml, simple

Initial Language
PHP