I have a variable $v that can be either single string or array of strings
and I have a code:
$a = array();
if (is_array($v)) {
$a = $v;
} else {
$a[] = $v;
}
How it can be done in more elegant way? (in other words, how to cast a variable to array)
See Question&Answers more detail:os