首页 > Web开发 > 详细

PHP7新特性

时间:2020-01-15 12:04:26      阅读:74      评论:0      收藏:0      [点我收藏+]

1、强类型转换:

  declare(strict_types=1)必须是文件的第一个语句。如果这个语句出现在文件的其他地方,将会产生一个编译错误,块模式是被明确禁止的。

类似于encoding指令,但不同于ticks指令,strict_types指令只影响指定使用的文件,不会影响被它包含(通过include等方式)进来的其他文件。该指令在运行时编译,不能修改。它的运作方式,是在opcode中设置一个标志位,让函数调用和返回类型检查符合类型约束。

见链接:https://blog.csdn.net/beyond__devil/article/details/52584082

2、void类型

   Type declarations for parameters and return values can now be marked as nullable by prefixing the type name with a question mark. This signifies that as well as the specified type, NULL can be passed as an argument, or returned as a value, respectively.

    可以返回空值 比如null 

   https://www.php.net/manual/en/migration71.new-features.php

  

PHP7新特性

原文:https://www.cnblogs.com/cbugs/p/12195451.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!