fork download
  1. <?php
  2. function myfunction($matches){
  3. return "<span>".$matches[0]."</span>";
  4. }
  5.  
  6. $buffer = "<tag>text text text 1233425345 text 234 text 324524352</tag>";
  7. $buffer = preg_replace_callback("/([0-9]){4,}/","myfunction",$buffer);
  8. echo $buffer;
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
<tag>text text text <span>1233425345</span> text 234 text <span>324524352</span></tag>