|
Posted by Mladen Gogala on 04/14/06 06:45
On Thu, 13 Apr 2006 15:20:10 -0700, Chung Leong wrote:
> To tell if a variable holds an array--use is_array(). To force a
> variable into being an array, do (array) $var or settype($var,
> 'array').
Of course, type casting prevents you from seeing mistakes. I prefer to
kill the script if the scalar is passed instead of array. For that, there
is an "exit" function: if (!is_array($var)) {
exit(" var should be an array at line:".__LINE__);
}
--
http://www.mgogala.com
[Back to original message]
|