Concept

How do PHP tags distinguish PHP code from static text?

ComputerScienceOne / PHP Tags

"PHP code can be interleaved with static HTML or text. Because of this, we need a way to indicate what should be interpreted as PHP and what should be treated as static text. We can do this using PHP tags: the opening tag is <?php and the closing tag is ?>. Anything placed between these tags will be interpreted as PHP code which must adhere to the syntax rules of the language. A file can contain multiple opening/closing PHP tags to allow you to interleave multiple sections of HTML or text. When an interpreter runs a PHP script, it will start processing the script file. Whenever it sees the opening PHP tag, it begins to execute the commands and stops executing commands when it sees the closing tag. The text outside the PHP tags is treated as raw data. The interpreter includes it as part of its output without modifying or processing it."

Related Ideas

How do PHP tags distinguish PHP code from static text? | ComputerScienceOne | Bifalgorithm | Bifalgorithm