PHP EoT delimiter use detailed _php tutorial

Source: Internet
Author: User
Tags escape quotes
The end identifier must start at the first column of the row. Similarly, identifiers must follow the naming conventions of any other tag in PHP: They can only contain alphanumeric underscores, and must begin with an underscore or non-numeric character.
Warning
It is important to note that the line where the end identifier is located cannot contain any other characters, except for a semicolon (;). This in particular means that the identifier cannot be indented and cannot have any spaces or tabs before and 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, in the Macintosh system is \ r.
If you break this rule so that the end identifier is not "clean", it will not be considered a closing identifier, and PHP continues to look for it. If the appropriate end identifier is not found in this case, it will result in a syntax error that appears in the last line of the script.
Class members cannot be initialized with delimiter syntax. Replace with other string syntax. Example 11-3. Examples of illegal
PHP code
class Foo {
Public $bar = << Bar
EOT;
}
?>
The delimiter text behaves just like a double-quoted string, with no double quotes. This means that you do not need to escape quotes in the delimiter text, but you can still use the escaped code listed above. Variables are expanded, but when you express complex variables in the delimiter text, you should be aware of the same as the string. 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: The delimiter support is added in PHP 4.
How to output HTML code in PHP (EOT)
PHP code
Echo <<< EOT









http://www.bkjia.com/PHPjc/319515.html www.bkjia.com true http://www.bkjia.com/PHPjc/319515.html techarticle the end identifier must start at the first column of the row. Similarly, identifiers must follow the naming conventions of any other tag in PHP: They can only contain alphanumeric underscores, and must be underlined ...

  • EOT;?>
    ClassID Stuno Student Name Parent's name Parent Mobile Number

    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.