What are Array constants?

Dana
Written by Dana

Posted On: Jan 09, 2019

 

    1 Answer Written

  •  Dana
    Posted by imran

    In PHP 5.6 or we can define constants as a scalar expression. We can define an array constant using the define keyword.

    Array Constant Example in PHP

     define('fruits', [
          'apple',
          'mango',
          'banana'
       ]);
     print(fruits[2]); // outputs banana
    

Please Login or Register to leave a response.

Related Questions