Home > Backend Development > PHP Tutorial > sorry seems to be the hardest Detailed explanation of the use of PHP EOT delimiter

sorry seems to be the hardest Detailed explanation of the use of PHP EOT delimiter

WBOY
Release: 2016-07-29 08:38:53
Original
1200 people have browsed it

The end identifier must start in the first column of the row. Likewise, identifiers must follow the naming rules for any other tag in PHP: they must only contain alphanumeric underscores, and they must start with an underscore or a non-numeric character.
Warning
It is important to point out that the line ending the identifier cannot contain any other characters, except perhaps a semicolon (;). This means in particular that the identifier cannot be indented and there cannot be any spaces or tabs before or after the semicolon. It's also important to realize that the first character before the closing identifier must be a newline character as defined in your operating system. For example, on Macintosh systems it is r.
If you break this rule so that the end identifier is not "clean", it will not be treated as an end identifier and PHP will keep looking for it. Failure to find a suitable closing identifier in this case will result in a syntax error on the last line of the script.
Class members cannot be initialized using delimiter syntax. Use other string syntax instead. Example 11-3. Illegal example
PHP code
class foo {
public $bar = <<bar
EOT;
}
?>
Delimiter text representation Just like a double-quoted string, except without the double quotes. This means that quotes do not need to be escaped within delimited text, but the escape codes listed above can still be used. Variables are expanded, but the same care must be taken when expressing complex variables in delimited literals as with strings. Example 11-4. Delimiter string example
PHP code
$str = <<Example of string
spanning multiple lines
using heredoc syntax.
EOT;
/* More complex example, with variables. */
class foo
{
var $foo;
var $bar;
function foo()
{
$this->foo = 'Foo';
$this->bar = array('Bar1', 'Bar2', 'Bar3');
}
}
$foo = new foo();
$name = 'MyName';
echo <<My name is " $name". I am printing some $foo->foo.
Now, I am printing some {$foo->bar[1]}.
This should print a capital 'A': x41
EOT;
? >
Note: Delimiter support was added in PHP 4.
How to output html code (EOT) in php
PHP code
echo <<< EOT








EOT;
?>

The above introduces the detailed explanation of the use of sorry seems to be the hardest PHP EOT delimiter, including the content of sorry seems to be the hardest. I hope it will be helpful to friends who are interested in PHP tutorials.

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
ClassID stuno< /td>
Student name Parent name Parent mobile phone number