User Tools

Site Tools


uphp:functions:gettype

gettype

WM-ULTRA >= 4.1195 WMMEGA FW >= 2.1195

The gettype() function is an inbuilt function in uPHP which is used to get the type of a variable. It is used to check the type of existing variable.

Description

string gettype ( mixed $variable )

Parameter

$variable: Variable to check the type of

Return Values

String: This function returns a string type value. Possible values for the returned string are:

  integer
  long
  float    
  string
  array
  array_byte
  array_short
  array_int
  array_float

Examples

<?
  $x=1;
  print(gettype($x)); // outputs integer
  $y=1.0;
  print(gettype($y)); // outputs float
  $z="1.0";
  print(gettype($z)); // outputs string
  $arr=indexed_array(2,10);
  print(gettype($arr)); // outputs array_short
?>

See Also

is_int() - Check if a variable is an integer

is_numeric() - Check if a value is numeric (int, float or numeric string)

is_string() - Check if a variable is a string

is_array() - Check if a variable is an array

isset() - Check if a variable exists

uPHP Variable Types and Limits

uphp/functions/gettype.txt · Last modified: 2021/09/13 05:57 (external edit)