php - How to quickly check what variables exist from a bunch of vars? -
if have 10 variables set, other times unset, there quick way echo ones exist without throwing exception? these vars come user input.
i write
if ($var_1 != null) { echo $var_1; } if ($var_2 != null) { echo $var_2; } if ($var_3 != null) { echo $var_3; } if ($var_other_1 != null) { echo $var_other_1 ; } if ($var_other_2 != null) { echo $var_other_2 ; }
etc.. there more quicker way?
compact function you
Comments
Post a Comment