Since PHP 5.6, you can declare an array constant with const
:
<?php
const DEFAULT_ROLES = array('guy', 'development team');
The short syntax works too, as you'd expect:
<?php
const DEFAULT_ROLES = ['guy', 'development team'];
If you have PHP 7, you can finally use define()
, just as you had first tried:
<?php
define('DEFAULT_ROLES', array('guy', 'development team'));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…