Can a constant be an array?

const bart = [‘yo’, ‘craziness’, ‘madness’];

Train Asked on November 12, 2015 in PHP.
Add Comment
  • 1 Answer(s)

    Before php5.6, the answer was, You just can’t do it, which will give a fatal error.

    Fatal error :  Arrays are not allowed as constants

    But now with php5.6, you can do it, which is great  🙂

    Train Answered on November 12, 2015.
    Add Comment

    Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.