带有新闻和资料链接的新鲜选择。 在发行版中:PHP更新,Codeception 3.0和其他发行版,PHP 7.4中的简短lambda和PHP Internals的最新RFC句子概述,一部分有用的工具等等。祝您阅读愉快!
fn() =>
$y = 1; $fn = fn($x) => $x + $y;
andOperator = ($x) => ($y = 10) && $x + $y; console.log(andOperator(5)); // 15
$andOperator = fn($x) => ($y = 10) && $x + $y; var_dump($andOperator(5)); // bool(true)
end()
<?php function last(...$args) { return end($args); } $multipleLines = fn($x) => last( $y = $x * 10, // 10 $z = $y + 15, // 25 $x + $y + $z // 1 + 10 + 25 last() ); var_dump($multipleLines(1)); // int(36)
array_slice()
$multipleLines = fn($x) => array_slice([ $y = $x * 10, $z = $y + 15, $x + $y + $z ], -1)[0]; var_dump($multipleLines(1)); // int(36)
<?
...
$parts = ['apple', 'pear']; $fruits = ['banana', 'orange', ...$parts, 'watermelon']; // ['banana', 'orange', 'apple', 'pear', 'watermelon'];
iterator_to_array
$array = [...$iter];
__toString()
感谢您的关注!如果您发现错误或不准确,请在PM中通知我。问题和建议写在邮件或推特上 。有关PHP Digest Telegram Channel的更多新闻和评论。发送链接搜索所有摘要的链接← 先前版本:PHP文摘154
Source: https://habr.com/ru/post/zh-CN450642/More articles:前端每周摘要(2019年4月29日至5月5日)768字节的Cram Basic上周第363期(2019年4月29日至5月5日)来自前端世界的新鲜材料摘要Magento 2. Monolog或如何编写日志如何理解自己确实戒烟加密货币:是生还是死? 第三部分PS2 / PSP模拟器+ Google云端硬盘+ YouTube =“疯狂”继续以应用程序为中心的基础架构。 未来的网络架构-从推理到业务给未来程序员的信息英特尔处理器Megazap-职位补充All Articles