[PHP] Dynamic constant names -SOLVED

2001-03-27 Thread Geoff Caplan
Art, Thanks for the suggestion, but I think there is a flaw in your solution. The original issue was how to get at the value of a constant where the $constant_name is dynamically created as a variable. In your solution you have defined constant_name as a constant! So when you assign it, it does

[PHP] Dynamic constant names - SOLVED

2001-03-27 Thread Geoff Caplan
Hi folks I mailed this to the list some time ago, but it seems to have got "lost" so here is is again... I had 2 suggestions from the list: 1) indirection - $constant_value = $$constant_name ; I had already tried this, but couldn't get it to work. Unless I am missing something it just gives an

[PHP] Re: Re[PHP] Dynamic constant names -SOLVED

2001-03-27 Thread Art Wells
I'm sorry to jump in mid-stream here (I've been offline for a while), but was $constant_value=${constant_name}; suggested? eval's spook me, so I would prefer this solution over the working suggestion you received. This works for me on 4.0.4: $test_name="ta_dah"; define("constant_name","test_nam

[PHP] Re[PHP] Dynamic constant names -SOLVED

2001-03-27 Thread Geoff Caplan
Hi folks I had 2 suggestions from the list: 1) indirection - $constant_value = $$constant_name ; I had already tried this, but couldn't get it to work. Unless I am missing something it just gives an "Undefined Variable" error. 2) eval("\$constant_value = $constant_name;") ; This does work. Th