fork(1) download
  1. <?php
  2. function bbcode($data)
  3. {
  4. $input = array(
  5. '/\[b\](.*?)\[\/b\]/is',
  6. '/\[b\](.*?)$/',
  7. );
  8. $output = array(
  9. '<b>$1</b>',
  10. '<b>$1</b>',
  11. );
  12. return preg_replace ($input, $output, $data);;
  13. }
  14.  
  15. $bcode = bbcode('[b]this is testing text');
  16. echo $bcode;
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
<b>this is testing text</b>