title: PHP loadHTML getting HTML5 data attributes
body: <p>I'm loading an HTML string that may have arbitrary custom HTML5 'data-' attributes such as</p>
  
  <pre><code>&lt;div data-test='foo'&gt;&lt;/div&gt;
  </code></pre>
  
  <p>I can access those attributes if I know the exact name like:</p>
  
  <pre><code>echo $element-&gt;getAttribute('data-test');
  </code></pre>
  
  <p>which will find and print the value of the attribute.
  HOWEVER, if I try to loop through all attributes:</p>
  
  <pre><code>foreach($element-&gt;attributes as $att){
      echo $att-&gt;value'
  }
  </code></pre>
  
  <p>it does not find the custom 'data-' attributes. That is a problem, as I'm trying to remove unwanted 'data-' attributes without knowing all of the possible names in advance.</p>