Good day!
I would like some help in removing strings inside the square brackets and including the square brackets.
The string looks like this:
$str
The below code will change to newline characters:
$str = "Lorem ipsum dolor[ Context are found on www.example.com ] some text here"; $str = preg_replace( "/\[[^\]]*\]/m", "", $str); echo $str;
Output:
Lorem ipsum dolor some text here
Lorem ipsum dolor
some text here