PHP 常量数组

3484 1
LZH实名认证 2022-4-9 20:40:21 | 显示全部楼层 |阅读模式
在 PHP 5.6 中仅能通过 const 定义常量数组,PHP 7 可以通过 define() 来定义。

实例
<?php
// 使用 define 函数来定义数组
define('sites', [
   'Google',
   'Runoob',
   'Taobao'
]);

print(sites[1]);
?>
以上程序执行输出结果为:

Runoob
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2026 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行