PHP VERSION: 7.0.26

array_constants.php

<?php

// works in php 5.x and 7
const NAME 'Jim';
const 
EMAIL NAME '@starfleet.gov';
const 
FRUIT = ['apple''banana''cherry''durian'];

echo 
EMAIL;
var_dump(FRUIT);

// works in php 7
define('CITIES', ['Utrecht','Reading','Santa Rosa','Aberdeen','Surin']);
var_dump(CITIES);

Output


Jim@starfleet.govarray(4) {
  [0]=>
  string(5) "apple"
  [1]=>
  string(6) "banana"
  [2]=>
  string(6) "cherry"
  [3]=>
  string(6) "durian"
}
array(5) {
  [0]=>
  string(7) "Utrecht"
  [1]=>
  string(7) "Reading"
  [2]=>
  string(10) "Santa Rosa"
  [3]=>
  string(8) "Aberdeen"
  [4]=>
  string(5) "Surin"
}
SOURCE CODE