codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?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);
Private
[
?
]
Run code
Submit