<?php
$str = 'Example: hello world, this world rocks.
What it should do is:
if it finds the word hello it should
remove the whole line. How can i do that and there
could be words in between brackets and inverted commas also.';
$lines = explode("\n", $str);
foreach($lines as $index => $line) {
if (strstr($line, 'hello')) {
unset($lines[$index]);
}
}
$str = implode("\n", $lines);
var_dump($str);