How would you add a class named newClass to an opening tag like <a class='abc'> or <p style=display:block> using php?
How would you add a class named newClass to an opening tag like <a
Share
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.
Regexp example:
using http://php.net/manual/en/book.dom.php example
I’m purposely not using
loadHTML(inside the function) to prevent having to dive down into the autogenerated html structure to find the actual given$htmlString. This of course implies that$htmlStringhas to be well-formed.