Table of Contents

is_string

WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0

Check if a variable is a string

Description

int is_string ( mixed $variable )

Check to see if a variable or value is of type string

Parameter

$variable: Variable or expression to be evaluated

Return Values

Integer: 1 (true) if a string, 0 (false) if not a string

Examples

<?
  $x=1.0;
  print(is_string($x)); // outputs 0, $x is a float
  $y="1.0";
  print(is_string($y)); // outputs 1, $y is a string
  $z=''
  print(is_string($z)); // outputs 1, $z is an empty string
?>

Notes

This function checks ONLY the type of the variable, not the data that it holds!

See Also

is_int() - Check if a variable is an integer

is_float() - Check if a variable is a float

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

is_array() - Check if a variable is an array

isset() - Check if a variable exists

uPHP Variable Types and Limits