I am extracting a file using $data = file_get_contents("file.html");
I want to replace all html tags from $data using a specified string (e.g : \n) . I can do this for a single line not for entire data .
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could try this
and change the second parameter.
This would turn
<b>This text is bold</b>to[b]--This text is bold--[/b]\\1returns the tag (in the opening brackets),\\2returns whatever was in between the tags and\\3returns the tag again (in the closing brackets)Try playing around with it
EDIT: If you want to replace all HTML tags with
\n, then do this