fork download
  1. <?php
  2.  
  3. $message="I have a [red][car]";
  4. echo preg_replace('/\[([^\]]+)]\[([^\]]+)]/',"<b style='color:$1'>$2</b>",$message);
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
I have a <b style='color:red'>car</b>