str replace - php remove a line after specific words with str_replace -
there text in file example:
<div class="from">jack</span></div> hey u <div class="from">ron</span></div> bye
i trying delete new line tag after "" , replace "|"
the result need is:
<div class="from">jack</span></div>|hey u <div class="from">ron</span></div>|bye
i tried think got wrong because job.
$string = file_get_contents($filename); $string = str_replace('/(<\/span><\/div>\r\n)', '|', $string); file_put_contents($filename, $string);
what right way?
thanks
<?php $string = '<div class="from"><span>jack</span></div> hey u'; echo preg_replace('/\r\n/', '|', $string);
php str-replace
No comments:
Post a Comment