View Single Post
  #1 (permalink)  
Old 04-14-2008, 12:54 PM
dman_2007
Guest
 
Posts: n/a
Default Tip : all about php data types

PHP supports eight data types :

Four scalar types :
  1. boolean
  2. integer
  3. float
  4. string

two compund types :
  1. array
  2. object

and finally two special types :
  1. resource
  2. null

You can find out a variable or expressions value and type bu using var_dump function, gettype function can also be used for finding out the type of a variable.

If you want to converta variable to a specific data type you can use settype function. Alternatively you can aslo cast it to a different type. You can use following casts to convert a variable to your desired data type in php :
  1. (bool), (boolean)
  2. (int), (integer)
  3. (float) (real), (double)
  4. (string)
  5. (array)
  6. (object)
Reply With Quote