fork download
  1. <?php
  2.  
  3. $text = "<B>FOO</B>";
  4. $text = preg_replace_callback("~(</?)(\w+)([^>]*>)~", function($subs) {
  5. return $subs[1] . strtolower($subs[2]) . $subs[3];
  6. }, $text);
  7. echo $text;
Success #stdin #stdout 0.01s 82944KB
stdin
Standard input is empty
stdout
<b>FOO</b>