Constant Arrays

Array constants can now be defined using the define() function. In PHP 5.6, they could only be defined using const keyword.

<?php
   //define a array using define function
   define('languages', [
      'PHP',
      'JSP',
      'ASP'
   ]);
   print(languages[0]);
?>

Leave a Reply

Your email address will not be published. Required fields are marked *