Php eot delimiters

Source: Internet
Author: User

The end identifier must start from the first column of the row. Similarly, the identifier must follow the naming rules for any other tag in PHP: it can only contain letters, numbers, underscores (_), and must start with an underscore or a non-digit character.
Warning
It is important to note that the row of the end identifier cannot contain any other character, except a semicolon. This especially means that the identifier cannot be indented, and there cannot be any spaces or tabs before or after the semicolon. It is also important to realize that the first character before the end identifier must be a line break defined in your operating system. For example, \ r is used in a Macintosh system.
If this rule is broken so that the end identifier is not "clean", it will not be regarded as the end identifier, and PHP will continue searching for it. If an end identifier cannot be found in this case, a syntax error occurs in the last line of the script.
Class Members cannot be initialized using the delimiter syntax. Use other string syntax instead. Example 11-3. Invalid example
PHP code
<? Php
Class foo {
Public $ bar = <EOT
Bar
EOT;
}
?>
The delimiter text is the same as the double quotation mark string, but it does not contain double quotation marks. This means that no escape quotation marks are required in the delimiter text, but the escape Code listed above can still be used. The variable is expanded, but when the complex variable is expressed in the delimiter text, you should also note the same as the string. Example 11-4. delimiter string example
PHP code
<? Php
$ Str = <EOT
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 <EOT
My name is "$ name". I am printing some $ foo-> foo.
Now, I am printing some {$ foo-> bar [1]}.
This shoshould print a capital 'A': \ x41
EOT;
?>
Note: The delimiters can be added to PHP 4.
How to output html code (EOT) in php)
PHP code
<? Php
Echo <EOT
<Table width = 80% border = "2" cellpadding = "3" cellspacing = "0" bordercolor = "#808080">
<Tr bgcolor = "#84A9E1">
<Td align = "center"> ClassID </td>
<Td align = "center"> stuno </td>
<Td align = "center"> Student name </td>
<Td align = "center"> parent name </td>
<Td align = "center"> parents' mobile phone number </td>
</Tr>
EOT;
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.