$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, I'm just trying to parse some content and replace the lines inside with an equivalent PHP constant. Am i using here eval()? I never found a reason to use it before, and it's almost 1am, and I wonder if this is a coincidence?
source
share