is_string()


bool is_string ( mixed $var )

Description

is_string() checks whether a variable is a string or not.

※ available F/W version : all

Parameters

Return values

Returns TRUE if $var is a string, otherwise FALSE.

Example

<?php
$val1 = "100";
$val2 = 100;

$ret1 = is_string($val1);
$ret2 = is_string($val2);

if($ret1) echo "ret1 is a string\r\n";  // OUTPUT: ret1 is a string
else echo "ret1 is NOT a string\r\n";

if($ret2) echo "ret2 is a string\r\n";
else echo "ret2 is NOT a string\r\n";  // OUTPUT: ret2 is NOT a string
?>

See also

is_array() / is_bool() / is_float() / is_int()

Remarks

This function is identical to the PHP group’s is_string().