

New features of PHP7.3: flexible heredoc and nowdoc syntax structures will be ushered in
The php.net RFC channel has announced the Heredoc and Nowdoc syntax updates for PHP 7.3. This update focuses on code readability:
## From the current implementation of PHP 7.2, like this simple example:Heredoc and Nowdoc has a very strict syntax, which sometimes makes many developers avoid it because they look very ugly in the code, making the code less readable. In response to this problem, this update has made the following two changes to the syntax:
supports the indentation of closing tags;
Line breaks for closing tags are no longer forced;
<?php class foo { public $bar = <<<EOT bar EOT; }in version 7.3 , the following forms are available:
<?php class foo { public $bar = <<<EOT bar EOT; }The indentation of the closing tag determines the number of spaces per new line in heredoc/nowdoc:
<?php // 4 个缩进空格 echo <<<END a b c END; /* a b c */In the current implementation of PHP 7.2, A newline must exist to end heredoc/nowdoc. PHP 7.3 removes this constraint:
<?php stringManipulator(<<<END a b c END); $values = [<<<END a b c END, 'd e f'];Background of Heredoc and NowdocNowdoc is supported from PHP 5.3.0 version. The only difference between it and Heredoc is double quotes and single quotes. The difference between quotation marks. Nowdoc adds single quotes around the start tag, and there is no parsing:
<?php $name = 'Example'; $str = <<<'EOD' Example of string $name spanning multiple lines using nowdoc syntax. EOD;The above nowdoc will output:
Example of string $name spanning multiple lines using nowdoc syntax.Here The definition of the document on the wiki:
In computer science, a here document, also known as a heredoc, hereis, here-string or here-script, is a file input or data stream input: a block of code that can be treated as a complete file. It can save whitespace characters such as line breaks or indents in the text. Some languages allow variable substitution and command substitution within strings.Improvements in Heredocs and Nowdocs will make your PHP code more readable and error-prone. On the other hand, the output is more concise and direct because the indentation that would close the markup is removed. Get more information It is recommended to read the official change document - flexible Heredoc and Nowdoc Syntaxes RFC. PHP official documentation Heredoc and Nowdoc.

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),

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.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6
Visual web development tools

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.