I need to store an array
to a constant. I am using PHP 5.6, so cant use define
. I am getting that data from database.
It is working for -
const VAR_DATA = array(1, 2, 3);
But when I do -
$var = array(1, 2, 3);
const VAR_DATA = $var;
It is giving me syntax error.
How can I achieve that?
Not duplicate as That question dose not answer how to achieve this. For regular arrays it is working but when I am using a variable it is giving me the error.