Fresh selection with links to news and materials. In release: PHP updates, Laravel 5.8, Xdebug 2.7 and other releases, 3 fresh RFCs, 2 accepted, and a concept from PHP Internals, a portion of useful tools, and much more.
Enjoy reading!
==
and make loose comparisons less error-prone. In particular, the comparison of numbers is proposed to be used only if the compared string is in fact a numeric one. Otherwise, the number is converted to a string, and a string comparison is performed.<=>
, ==
!=
, >
, >=
, <
, And <=
, switch
constructions, functions of the in_array()
, sort()
and other types.declare('strict_comparison=1');
which would turn everything ==
into ===
, until the proposal to cancel == in general ."123 " == " 123"
and all other operations worked, as well as for lines with leading spaces.locked
keyword for classes. Such classes will be closed for dynamic use of properties, that is, you cannot access undeclared properties: locked class TestClass { public $definedProp; } $t = new testClass(); $t->definedProp = "OK"; echo $t->definedProp; unset($t->definedProp); echo $t->nonExistentProp; // Error $t->nonExistentProp = "Not OK"; // Error unset($t->definedProp); // Error
__toString
. $a = [1, 2, 3]; $mul = 3; $c = [ for $a as $v yield $mul * $v use ($mul) ];
Thanks for attention!
If you notice an error or inaccuracy - please inform the PM .
Write questions and suggestions by mail or twitter .
More news and comments on the PHP Digest Telegram channel.
Send link
Search links for all digests
← Previous release: PHP Digest number 150
Source: https://habr.com/ru/post/443220/
All Articles