$val) { ${$var} = $val; } $details = ''; if (!empty($name) && !empty($value)) { $txt = 'is equal to'; if (preg_match('`,`', $value)) { $txt = 'is one of these values:'; } $details = '
show if ' . $name . ' ' . $txt . ' ' . $value . ''; } echo '

-- Dependent fields start --' . $details . '

';