I saw this code when I was learning php through the source code, but I didn't understand this way of writing. What is the official name of this writing in php
CodePudding user response:
The given code example does nothing else as printing the given HTML elements.
function disinfo() {
?><h1>i muss you</h1><?
}
disinfo(); // results into <h1>i miss you</h1>
The declaration interrupts PHP and falls back into pure HTML. PHP has always been able to be written as a quasi template engine with HTML elements in a file that is interpretable by PHP. You do not even have to echo the markup. Since PHP is interupted with an ending delimiter and starts again with a starting delimiter everything in between is simply interpreted as html.
In fact there is no official name for this kind of output.