See:
$class_members = get_class_vars(__CLASS__);
foreach($class_members as $key => $value)
{
if (strpos($key, '_output') === 0)
{
// I want to eval() this
$code = '$this->' . $key . ' = 0;';
}
}
Assume I want to assign the value 0 to all class members that begin with _output. I plan to use eval. Good or bad idea?
You don’t need
eval()for this. You can use a variable as in$this->{$key}: