Practice exercise: Data Typing Functions

Categories data:
  Boolean: this is a logical type.  Possible values are true, false.
  Integer: A data type for integers, or numbers without a decimal point.
  Floating-point (double, float):  A data type for decimal numbers.
  String: A string is series of characters.
    Specify by enclosing them in single quotes or double quotes.

Testing data types:
  Test types and validity with the is_* family of functions including:
    is_null( ), is_int( ), is_string( ), is_double( ), is_bool( ),
    is_numeric( ), ....
1. Declare variables $nullVar, $intVar, $stringVar, $doubleVar, $boolVar
   and imply type with assigned values.







2. Use the is_* functions to test the variables from 1.







Changing type:
  Data type may be changed explicity with he function settype( ) with
  arguments for $variableName and data type. Data types may be 'integer',
  'string', 'double', 'bool'.
3. Declare $aVariable, initialized to 1.23, then print its value along
   with the result from invoking is_double( ).


4. Apply settype( ) to change $aVariable to 'string', 'integer', back to
   double, and to boolean.  After each setting, print its value and the
   result from invoking the corresponding is_*( ).








Type Casting:
  Changing data type by casting is done by indicating the name of a data
  type within parentheses in front of a variable name (e.g. (double) $aVar).
  Casting produces a copy that is converted to the specified type.
5. Declare and intialize $aVar to 4.56.  Code a statement to assign $aVar
   to $temp, then print $temp and the result of is_double($temp).



6. Write additional statements to cast $aVar as a string, an integer, again
   as a double, and as a boolean, each time assigning the result to $temp.
   Print $temp and the result of is_double($temp).