はじめに
PHP 7.3.0 がリリースされました。
PHP: PHP 7.3.0 Release Announcement では、主な新機能として以下の7つが挙げられています。
詳しく知りたい場合は、php-src/UPGRADING 2. New Features を読むとよさそうです。
ここでは、はじめの3つに関して関連するところを抜粋します。
Flexible Heredoc and Nowdoc Syntax
Core:
. Implemented flexible heredoc and nowdoc syntax: The closing marker for doc
strings is no longer required to be followed by a semicolon or newline.
Additionally the closing marker may be indented, in which case the
indentation will be stripped from all lines in the doc string.
引用元:php-src/UPGRADING 2. New Features
関連情報
PCRE2 Migration
PCRE:
. The PCRE extension has been upgraded to PCRE2, which may cause minor
behavioral changes (for instance, character ranges in classes are now more
strictly interpreted), and augments the existing regular expression syntax.
See for details.
引用元:php-src/UPGRADING 2. New Features
関連情報
Multiple MBString Improvements
MBString:
. Support for full case-mapping and case-folding has been added. Unlike simple
case-mapping, full case-mapping may change the length of the string. For
example:
mb_strtoupper("Straße")
// Produces STRAßE on PHP 7.2
// Produces STRASSE on PHP 7.3
The different casing mapping and folding modes are available through
mb_convert_case():
. MB_CASE_LOWER (used by mb_strtolower)
. MB_CASE_UPPER (used by mb_strtoupper)
. MB_CASE_TITLE
. MB_CASE_FOLD
. MB_CASE_LOWER_SIMPLE
. MB_CASE_UPPER_SIMPLE
. MB_CASE_TITLE_SIMPLE
. MB_CASE_FOLD_SIMPLE (used by case-insensitive operations)
Only unconditional, language agnostic full case-mapping is performed.
. Case-insensitive string operations now use case-folding instead of case-
mapping during comparisons. This means that more characters will be
considered (case insensitively) equal now.
. mb_convert_case() with MB_CASE_TITLE now performs title-case conversion
based on the Cased and CaseIgnorable derived Unicode properties. In
particular this also improves handling of quotes and apostophes.
. Data tables have been updated for Unicode 11.
. Mbstring now correctly supports strings larger than 2GB.
. Performance of the mbstring extension has been significantly improved
across the board. The largest improvements are in case conversion functions.
. mb_ereg_*() functions now support named captures. Matching functions like
mb_ereg() will now return named captures both using their group number and
their name, similar to PCRE:
mb_ereg('(?\w+)', '国', $matches);
// => [0 => "国", 1 => "国", "word" => "国"];
Additionally, mb_ereg_replace() now supports the \k<> and \k'' notations
to reference named captures in the replacement string:
mb_ereg_replace('\s*(?\w+)\s*', "_\k_\k'word'_", ' foo ');
// => "_foo_foo_"
\k<> and \k'' can also be used for numbered references, which also works
with group numbers greater than 9.
引用元:php-src/UPGRADING 2. New Features
関連情報