PHP is_string() function

Description

is_string(value) returns true if value is a string.

Syntax

PHP is_string() function has the following syntax.

is_string(value)

Parameter

  • value is the variable being type checked.

Return

PHP is_string() function returns true if value is a string.

Example

Is it a string.


<?php//from  w w w . java2  s .  c o  m
$values = array(2, "2", 2.5, "2.5", null, true);
foreach ($values as $value) {
    echo "is_string(";
    var_export($value);
    echo ") = ";
    var_dump(is_string($value));
}
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions