mysqllaravelfckeditor

remove <p> from $description variable before storing in database(laravel)


i am getting value of input tag i.e an textarea converted into Fckeditor as:

"<p>bgfbgfbgf</p>\r\n"

i want to store my value in database after <p> tags get removed.

how should i remove the <p></p> tags from my value. can anyone help me with this.?


Solution

  • Use strip_tags to remove tags and str_replace to remove \r\n if needed:

    strip_tags(preg_replace('/\s+/', '', $string)))