moving companies : Computers : Programming : Languages : PHP : Function Libraries : Variables

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 6 people (100%) answered Yes
Recently 3 of 3 people (100%) answered Yes

Entry

[+] gettype : Get the type of a variable

Dec 23rd, 2000 01:08
Philip Olson,


------------------------------------------------------------------------
Definition : Returns the type of the PHP variable var. 
             Possibles values for the returned string are: 
               "boolean"  ,  "integer"  ,  "double"
               "string"   ,  "array"    ,  "object"
               "resource" ,  "unknown type"
               and depreciated type "user function" (PHP3 Only)
------------------------------------------------------------------------
Use         : $foo = 9;
              $bar = 'string';
              $sky = array('sun','cloud','bird');
              print gettype($foo); // prints 'integer'
              print gettype($bar); // prints 'string'
              print gettype($sky); // prints 'array'
------------------------------------------------------------------------
Related     : Since gettype() deals with types, you should learn 
              types!  In fact, you should learn about types anyways :-)
              General Types :
              http://www.php.net/manual/language.types.php
              Type Juggling :
              http://www.php.net/manual/language.types.type-juggling.php