search
HomeBackend DevelopmentPHP ProblemHow to use php delimiter

How to use php delimiter

Oct 09, 2019 am 09:47 AM
php

Delimiter

How to use php delimiter

The method of delimiting a string uses delimiter syntax (" (Recommended learning: PHP video tutorial)

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.

For example:

<?php
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;
?>

But please note:

ends the line where the identifier is located It 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, in Macintosh system 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: The delimiter text behaves the same as a double-quoted string, but 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.

Example:

<?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;
?>

The above is the detailed content of How to use php delimiter. For more information, please follow other related articles on the PHP Chinese website!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

MantisBT

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.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

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.