Apart from the identity comparison operator mentioned in the list before (===), you can of course the functions gettype() or any of the is_*() functions that have been in PHP since PHP 3 (at least). More details and information at the PHP manual (which should be required reading for anyione using PHP ;-), in particular the "Variable functions": http://www.php.net/manual/en/ref.variables.php HTH --- Rob <rcherry@jamwarehouse.com> wrote: > Is there any way to tell what type a variable is? My problem is this: > > I query a db table for a primary key that is an integer. If the key exists > I return it, > otherwise I return false. Then I can do some like this: > > $key = getKey("bob"); > //if false was not returned > if ($key) { > //do stuff > } > > But what happens if I get back a key of 0, since 0 in php is equivalent to > false? Is there any way to check whether > $key came back as an int or a bool? > > Thanks > > --- > Rob ===== --- Jesus M. Castagnetto (jcastagnetto@yahoo.com) Research: http://metallo.scripps.edu/ Personal: http://www.castagnetto.org/ __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com ------------------------ Yahoo! Groups Sponsor ---------------------~--> Turn flat surfaces into speakers with the Soundbug. http://us.click.yahoo.com/QWAVSC/onCFAA/xGHJAA/saFolB/TM ---------------------------------------------------------------------~-> Look here for Free PHP Classes of objects: http://phpclasses.UpperDesign.com/ To unsubscribe from this group, send an email to: php-objects-unsubscribe@egroups.com Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/