is_string

(PHP 4, PHP 5)

is_stringFind whether the type of a variable is string

Description

bool is_string ( mixed $var )

Finds whether the type given variable is string.

Parameters

var

The variable being evaluated.

Return Values

Returns TRUE if var is of type string, FALSE otherwise.

Examples

Example #1 is_string() example

<?php
if (is_string("23")) {
    echo 
"is string\n";
} else {
    echo 
"is not an string\n";
}
var_dump(is_string('abc'));
var_dump(is_string("23"));
var_dump(is_string(23.5));
var_dump(is_string(true));
?>

The above example will output:

is string
bool(true)
bool(true)
bool(false)
bool(false)

See Also

  • is_float() - Finds whether the type of a variable is float
  • is_int() - Find whether the type of a variable is integer
  • is_bool() - Finds out whether a variable is a boolean
  • is_object() - Finds whether a variable is an object
  • is_array() - Finds whether a variable is an array


Copyright © 2010-2024 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout