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

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

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

such as:

hasRole方法的返回值必须是布尔数据类型。

posted @ 2020-04-17 09:16  千逸山水  阅读(1842)  评论(0)    收藏  举报