How to use php delimiters?
Usage of delimiter
Delimiter
give The method of string delimitation uses delimiter syntax ("
The end identifier must start from 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.
Recommended: "PHP Tutorial"
For example:
<?php $str = <<<EOD Example of string spanning multiple lines using heredoc syntax. EOD; ?>
But please note:
End identifier The line cannot contain any other characters, except perhaps a semicolon (;). In particular, this 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 terminating 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 considered 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.
ps: Delimited text behaves the same as a double-quoted string, but without 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.
Example 1:
<?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">学生姓名</td> <td align="center">家长姓名</td> <td align="center">家长手机号</td> </tr> EOT; ?>
Example 2:
<? $xml=<<<EOT <message name="getTermRequest"> <part name="term" type="xs:string"/> </message> <message name="getTermResponse"> <part name="value" type="xs:string"/> </message> <portType name="glossaryTerms"> <operation name="getTerm"> <input message="getTermRequest"/> <output message="getTermResponse"/> </operation> </portType> EOT; echo $xml; ?>
The above is the detailed content of How to use php delimiters. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
