Skip to content

Instantly share code, notes, and snippets.

@timkelty
Created November 3, 2014 21:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timkelty/2a221ac232e5ecf1b090 to your computer and use it in GitHub Desktop.
Save timkelty/2a221ac232e5ecf1b090 to your computer and use it in GitHub Desktop.
Get all element attributes and content
$attributes = array_merge($element->getAttributes(), $element->getContent()->getAttributes());
array_walk($attributes, function(&$value, $handle) use ($element, $attributes) {
$value = !empty($element->$handle) ? $element->$handle : $attributes[$handle];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment