• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

Is variable a string.

Hi,

Very simple, how can I check a variable is a string?

Thanks,
Uni
0
Unimatrix_001
Asked:
Unimatrix_001
  • 2
2 Solutions
 
mars-vieCommented:
is_string
0
 
Pratima PharandeCommented:
if (is_string("23"))
0
 
Pratima PharandeCommented:
<?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));
?>
0
 
Unimatrix_001Author Commented:
:)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now