WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML


 

PHP 7 - Constant Arrays


Array constants would now be able to be characterized utilizing the define() work. In PHP 5.6, they must be characterized utilizing const keyword.


Example

<?php
   //define a array using define function
   define('animals', [
      'dog',
      'cat',
      'bird'
   ]);
   print(animals[1]);
?>

It produces the following browser output −

cat