You are here: Re: How to tell php a variable is an array? « PHP Programming Language « IT news, forums, messages
Re: How to tell php a variable is an array?

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация