fork(9) download
  1. <?php
  2. $string = 'Lorem ipsum /dolor sit amet/, consectetur /adipiscing elit/ aaaa /adipiscing elit/.';
  3.  
  4.  
  5. function removeParseContentBar($string)
  6. {
  7. $arr = str_split($string);
  8. $i=0;
  9. foreach ($arr as $k => $char) {
  10. if ($char == '/') {
  11. $arr[$k] = ($i % 2 == 0) ? '<' : '/>';
  12. } else {
  13. $arr[$k] = $char;
  14. $i++;
  15. }
  16. $i++;
  17. }
  18. $content = implode('',$arr);
  19. return strip_tags($content);
  20. }
  21. echo removeParseContentBar($string);
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Lorem ipsum , consectetur  aaaa .