0

I don't believe this is possible. But it would be pretty neat if it were. At least I could't find anything online about it, so I thought I'd ask here.

So we're using constants

cst_internalc::prefs_show_sidebar;
cst_internalc::prefs_days_remain;
cst_internalc::prefs_days_expire;

etc...

Basically, I'm trying to get a hold of these constants using a string.

so something like...

$string = sprintf('cst_internalc::prefs_%s', 'days_remain');

and then using that generated string to get the cst_internalc::prefs_days_remain constant.

Is something like this at all possible?

Thanks!

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Highwalker
  • 33
  • 6
  • It's would be nice to know the reason why you want to do this. The reason might surprise us and we may come up with better solutions for the problem you're trying to solve this way. – KIKO Software Sep 18 '17 at 23:06
  • Thanks for the super fast replies! That question does seem to answer my question. I'll definitely try it out! Probably should have thought about using dynamic in my google searches. Basically we have constants set up in a different file like this. `const cst_internalc::prefs_days_remain = 'days_remain'` And I'm trying to access them dynamically to set the default prefs. So having an array of the prefs like `array('days_remain', 'days_expire')` and iterating through the array to get the values of the constants. – Highwalker Sep 18 '17 at 23:19
  • And yes, that question does indeed answer my question. Thanks so much!! – Highwalker Sep 18 '17 at 23:26

0 Answers0