Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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