$constPrefix = '_CONST_';
if (strstr($content, $constPrefix)) {
$constants = array('PHP_VERSION', '__FILE__');
foreach($constants as $constant) {
$constantOutput = eval($constant);
$content = str_replace($constPrefix . $constant, $constantOutput, $content);
}
}
Basically, just trying to parse some content and replace strings inside with the equivalent PHP constant. Is eval()
what I should be using here? I've never actually found a reason to use it before, and it's almost 1am, and am wondering if that is a coincidence?