Advertisement
zero50x

Замена внутри всех заголовков

Nov 5th, 2015
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1.         preg_match_all("/<h2>(.*?)<\/h2>/ism", $contents, $titleArr);
  2.  
  3.         for ($j = 0; $j < count($titleArr[0]); $j++) {
  4.             $TNew = preg_replace("/<br\s\/>/ism", " ", $titleArr[0][$j]);
  5.             $TNew = preg_replace("/<br>/ism", " ", $TNew);
  6.             $TNew = preg_replace("/\n/ism", " ", $TNew);
  7.             $contents = str_replace($titleArr[0][$j], $TNew, $contents);
  8.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement