Hi guys
Just one quick question : how could you get rid of the if() condition in the following code in order to make it shorter?
Because when $array doesn't exist, foreach throws errors.
Thanks!
Just one quick question : how could you get rid of the if() condition in the following code in order to make it shorter?
Because when $array doesn't exist, foreach throws errors.
Code:
if (is_array($array)) {
foreach ($array as $key => $value) {
// do something
}
}
Thanks!