Concept
How do PHP tags identify code that should be interpreted as PHP?
ComputerScienceOne / Libraries
"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 · PHP Tags
- What is the purpose of a Hello World program in PHP?ComputerScienceOne · Getting Started: Hello World
- What are the main characteristics of PHP as a programming language?ComputerScienceOne · Basic Syntax Rules
- How does a PHP script use entry points and command line arguments?ComputerScienceOne · Entry Point & Command Line Arguments
- How are strings, statements, and code blocks written in PHP?ComputerScienceOne · Basic Syntax Rules
- How can PHP functions be organized in separate source files?ComputerScienceOne · Calling Functions
- How can related PHP functions be organized?ComputerScienceOne · Organizing Functions
- How are comments written in PHP code?ComputerScienceOne · PHP Tags