Need to replace certain phrases in a form, may not be possible

I’m new and just learning php and I need help if possible.
We have a form that contains the following when submitted
[php]$description = str_replace("’","’",$textfield)[/php]
what I’m also wanting to add, if possible is if people start the form with:

[ul][li]a blank line[/li]
[li]hi (followed by “return”)[/li]
[li]hi, (followed by “return”)[/li]
[li]hello (followed by “return”)[/li]
[li]hello, (followed by “return”)[/li]
[li]morning (followed by “return”)[/li]
[li]morning, (followed by “return”)[/li]
[li]urgent (followed by return)[/li][/ul]

I’m wanting those removing so it starts with the next line. We work on a helpdesk and we scan the list and only see the the first line.
We need line breaks in the rest of the text, it would just be if they put those words at the start or no words at all that we want the line break removing.

Any help would be greatly appreciated.

OK, I’ve got as far as the below, this removes the word but no it starts with a blank line, any ideas?

[php]$hi = array(“hi\n”,“hi\r”,“hi,\n”,“hi,\r”,“hello\n”,“hello\r”,“hello,\n”,“hello,\r”,“morning\n”,“morning\r”,“morning,\n”,“morning,\r”);

$description = str_replace($hi, “”, str_replace("’","’",$description))[/php]

figured it out, I put the whole lot within trim()

Sponsor our Newsletter | Privacy Policy | Terms of Service