Function : force_array()
This function let you force a value to be an array. It's useful if a variable is supposed being multiform, and let you skip is_array() conditional tag.
Here is an example:
<?php
// sample example with multiform var
$var = is_night() ? true : array( 'morning', 'evening' , 'midnight' );
foreach( force_array( $var ) as $_var ) // this loop works only if var is an array
{
// ...
}
Updated less than a minute ago