If i am having a text like bla bla bla bla then <--MakyFancy Ad code here--> BLA BLA BLA here is random code <--End of MakyFancy Ad code--> How i can remove everything that is inside the Maky Fancy breakers, including that MakyFancy ad code I hope you get me
Try: <?php $string = "1<--MakyFancy Ad code here-->BLA BLA BLA here is random code<--End of MakyFancy Ad code-->1"; $string = preg_replace("/<--MakyFancy Ad code here-->.*<--End of MakyFancy Ad code-->/","HEllO",$string); echo $string; ?> PHP: OUTPUT:1HEllO1