PHP 教程
PHP 7 新特性
在 PHP 5.6 中僅能通過 const 定義常量數(shù)組,PHP 7 可以通過 define() 來定義。
<?php // 使用 define 函數(shù)來定義數(shù)組 define('sites', [ 'Google', 'Runoob', 'Taobao' ]); print(sites[1]); ?>
以上程序執(zhí)行輸出結(jié)果為:
Runoob