PHP

PHP Dynamic Constants

TAGs: 1 Comment

Posted By: eligeske on in PHP

This is a way to print out a constant when you need to select the name dynamically.

Haven’t tried it yet, but I am adding because I am sure I will need it in the near future.

$changing_variable = 'foo_bar';
echo constant('FOO_' . strtoupper($changing_variable));

One Response to "PHP Dynamic Constants"

"SHARING IS CARING"
  1. seiha.ching says:

    Hello I am a student that studying web programming language. PHP is the most important for me. Because it is open source and good language.If it is free I need it

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Learning DHTMLX Suite UI

Learn the foundation of the DHTMLX Suite quickly while building a single page application with multiple components in harmony.

Popular post