fork(1) download
  1. <?php
  2.  
  3. $text = "No? Oh ? And ! and!";
  4. $text = preg_replace('~\s*([?!])~', '&nbsp;$1', $text);
  5. /*
  6. $text = str_replace(' ?', '?', $text);
  7. $text = str_replace('?', '&nbsp;?', $text);
  8. $text = str_replace(' !', '!', $text);
  9. $text = str_replace('!', '&nbsp;!', $text);*/
  10. echo $text;
Success #stdin #stdout 0s 52488KB
stdin
Standard input is empty
stdout
No&nbsp;? Oh&nbsp;? And&nbsp;! and&nbsp;!