Skip to content

Instantly share code, notes, and snippets.

@tieutantan
Last active December 23, 2016 12:04
Show Gist options
  • Save tieutantan/26beaeba728c08d91ab3 to your computer and use it in GitHub Desktop.
Save tieutantan/26beaeba728c08d91ab3 to your computer and use it in GitHub Desktop.
PHP remove all attribuite from html tag
<?php
$str = '
<p class="class_style" style="font-size: medium; line-height: normal; letter-spacing: normal;">content</p>
<span class="another_class_style" style="font-size: medium; line-height: normal; letter-spacing: normal;">content</span>
<ul class="another_class_style" style="background:#006;"></ul>
<li class="another_class_style" style=" list-style:circle; color:#930;">content</li>';
$clean = preg_replace('/ .*".*"/', '', $str);
echo $clean;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment