title: How to get the attribute from html string in php
body: <p>i have to get the attribute from string which contains html code. i'm using string parser to get the attribute but it is not working. 
  is there any way to get attribute from the string if the string having html code? for example...</p>
  
  <pre><code>$code ="&lt;i class='fa fa-facebook' style='font-size:40px'&gt;&lt;/i&gt;";
  </code></pre>
  
  <p>result expected as or get attribute value like...</p>
  
  <p><strong>fa fa-facebook</strong> and <strong>font-size:40px</strong></p>
  
  <p>i tried to parse it but it doesn't worked.</p>
  
  <p>thank you! in advance... :)</p>