Array constants can now be defined with define() function. In PHP 5.6, they could only be defined using const keyword.
Array constants can now be defined with define() function. In PHP 5.6, they could only be defined using const keyword.
<?php
// define a fruits's array using define function
define('FRUITS', [
'Apple', 'Mango', 'Banana', 'Papaya'
]);
print(FRUITS[2]);
?>
Output:
Banana