Fork me on GitHub

Loop thru constants?  Bottom

  • Hi,

    I'm struggling with a coding issue I haven't been able to fix so far. I have several constants defined as:

    define('_COLOR1','red');
    define('_COLOR2','white');
    define('_COLOR3','black');
    define('_COLOR4','green');

    I would like to loop thru all of them and echo their values.
    Loops like this dont work because they show the result string:

    for ($j=1; $j <= 4; $j++) {
    echo _COLOR.$i;
    }

    What's the right syntax to have the corresponding constant passed correctly?

    TIA
  • Take a look at the constant function.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Sweet! You rock, thanks
  • 0 users

This list is based on users active over the last 60 minutes.