PHP - 使用数组类常量 [英] PHP - use array as class constant

查看:187
本文介绍了PHP - 使用数组类常量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  是否可以声明一个数组恒定

是否有可能使用数组作为一类 PHP

Is it possible to use an array as a class constant in PHP?

const MYARRAY = array('123', '234');

如果不是,为什么?

推荐答案

不,你不能将数组分配到PHP不变。

No you can't assign an Array to PHP constant.

在<一个href=\"http://www.php.net/manual/en/language.constants.syntax.php\">http://www.php.net/manual/en/language.constants.syntax.php

常量的值只能是标量

这是什么原因。

有关实例标值 INT 浮动字符串

这篇关于PHP - 使用数组类常量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆