- print_r: documentation ( source)
<?php
$str = <<<STR
<p value="1,'goahead'" your='56' so='"<br />"'>
STR;
$DOM = new DOMDocument;
$DOM->loadHTML($str);
foreach ($DOM->getElementsByTagName('p')->item(0)->attributes as $attr) {
$attributes[$name] = $value;
}
print_r($attributes);