带有新闻和资料链接的新鲜选择。 在发行版中:PHP 7.3.0 Alpha 2,针对PHP 8.0的计划,来自PHP Internals的Typed Properties和其他RFC,有用的工具的一部分以及更多内容。祝您阅读愉快!
class Example { // All types with the exception of "void" and "callable" are supported public int $scalarType; protected Type $type; private ?Type $nullableType; // Types are also legal on static properties public static iterable $staticProp; // Types can also be used with the "var" notation var bool $flag; // Typed properties may have default values (more below) public string $str = "foo"; public ?string $nullableStr = null; // The type applies to all properties in one declaration public float $x, $y; // equivalent to: public float $x; public float $y; }
define()
switch
continue
break
switch ($a) { case FOO: // Works exactly as current behavior. break; case == FOO: // Nearly identical, though we don't use the ZEND_CASE optimization. // Can probably make this equivalent to `case FOO`, but it felt like an interesting direction. break; case === FOO: // Only triggers if `$a === FOO`, no type juggling break; }
感谢您的关注!如果您发现错误或不准确,请在PM中通知我。问题和建议写在邮件或推特上 。发送链接搜索所有摘要的链接← 先前版本:PHP文摘132
Source: https://habr.com/ru/post/zh-CN415057/More articles:6月25日至7月1日在莫斯科举行的数字活动在Django中创建管理命令等距,手机游戏中的z索引及其优化为什么Skylake处理器有时运行速度慢2倍上周第320号前端世界的新鲜材料摘要(2018年6月18日至24日)JavaScript美食的秘密:香料从前端到后端Blue Origin明年将开始向太空游客出售门票我们如何阅读80年代在奥斯威辛比克瑙第三个火葬场附近发现的手稿另一种追求梦想。 RTS + Eyetracker学生手All Articles