Function : convert_to_array()

This function let you transform a var into array if that one is not an array. This function can avoid you script generating errors, while a variable is not on an expected type.
It may avoid you to use so much conditional tags.

Here is an example :

<?php
$var = false; // it's just an example ;)
foreach( $var as $_var ) // displays an error
{
  // ...
}

$var = false;
foreach( convert_to_array( $var ) as $_var ) // this loop is valid. and false is now the first input of this array.
{
  // ...
}