PHP Functions for Variables

This section lists a few functions used to identify or create variables or constants. For more information see the PHP Manual.

  • define("GREETING", "Hello") - Used to define constants and set their value. This example defines the constant called GREETING with the string value "Hello". Constant values cannot later be changed.
  • gettype($var) - Returns the type of the variable as one of array, boolean, double, integer, string, object, resource, or unknown.
  • is_long($var) - Returns a boolean value of true if the variable is an integer.
  • is_double($var) - Returns a boolean value of true if the variable is a double.
  • is_float($var) - Returns a boolean value of true if the variable is a float.
  • is_int($var) - Returns a boolean value of true if the variable is an integer.
  • is_string($var) - Returns a boolean value of true if the variable is a string.
  • is_array($var) - Returns a boolean value of true if the variable is a double.
  • is_object($var) - Returns a boolean value of true if the variable is an object.