PHP constant array

In PHP 5.6, constant arrays can only be defined through const, and in PHP 7, they can be defined through define().

Example

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

print(sites[1]);
?>

The execution output of the above program is:

php
Continuing Learning
||
<?php // 使用 define 函数来定义数组 define('sites', [ 'Google', 'php', 'Taobao' ]); print(sites[1]); ?>
submitReset Code