For example, can I do:
if ($my_array = wp_get_category($id)) {
echo "asdf";
} else {
echo "1234";
}
If nothing is returned by the function, I want to go into the else statement.
For example, can I do:
if ($my_array = wp_get_category($id)) {
echo "asdf";
} else {
echo "1234";
}
If nothing is returned by the function, I want to go into the else statement.
Following is one more alternative to define any variable (with safety):
$my_array = ($my_array = $wp_get_category($id)) ?: /* else statement here */;