Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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