php函数名后冒号(:)+数据类型(返回值类型限制/php新特性)

php函数名后冒号(:)+数据类型(返回值类型限制/php新特性)

在PHP7,一个新的功能,返回类型声明已被引入。返回类型声明指定的一个函数返回值的类型。

  • int
  • float
  • bool
  • string
  • interfaces
  • array
  • callable
  • 对象实例

参考:https://www.runoob.com/php/php-scalar-return-type.html

原文地址:https://www.cnblogs.com/makalochen/p/14216214.html