How should we parse HTML in PHP?
Submitted by: MuhammadWhat exactly is meant by the sentence "For a complex resource such as an HTML document, the script would need
to parse it to find references to embedded, included resources:
javascript files, CSS files, iframes, etc."?
Well, as you probably know, an HTML page often uses other files to render the HTML page - like CSS file(s) for styling, Javascript file(s) for adding more functionality to the HTML page, and so on. But the question is how do we take an HTML page and find all of those resources in the HTML page. Of course, this is easy to do if we are reading the HTML page with the human eye. But, we want to find these resources using a program that will read the HTML for us. This is actually more complicated than it seems - and the process by which a program (like PHP) reads an HTML file and analyzes the text to extract meaningful data (like resources) is known as parsing the HTML. Any text can be parsed, but we are exclusively focused on HTML for the purpose of this interview question.
Submitted by: Muhammad
to parse it to find references to embedded, included resources:
javascript files, CSS files, iframes, etc."?
Well, as you probably know, an HTML page often uses other files to render the HTML page - like CSS file(s) for styling, Javascript file(s) for adding more functionality to the HTML page, and so on. But the question is how do we take an HTML page and find all of those resources in the HTML page. Of course, this is easy to do if we are reading the HTML page with the human eye. But, we want to find these resources using a program that will read the HTML for us. This is actually more complicated than it seems - and the process by which a program (like PHP) reads an HTML file and analyzes the text to extract meaningful data (like resources) is known as parsing the HTML. Any text can be parsed, but we are exclusively focused on HTML for the purpose of this interview question.
Submitted by: Muhammad
Read Online Sr. PHP Programmer Job Interview Questions And Answers
Top Sr. PHP Programmer Questions
☺ | What are the 3 scope levels available in PHP and how would you define them? |
☺ | What is the purpose of $_PHP_SELF variable in PHP? |
☺ | What is the purpse $_PHP_SELF variable? |
☺ | Can the value of a constant change during the script's execution? |
☺ | What is the purpose of _CLASS_ constant? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |