Solved

Is variable a string.

Posted on 2011-03-03
4
233 Views
Last Modified: 2012-05-11
Hi,

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

Thanks,
Uni
0
Comment
Question by:Unimatrix_001
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
mars-vie earned 250 total points
Comment Utility
is_string
0
 
LVL 39

Assisted Solution

by:Pratima Pharande
Pratima Pharande earned 250 total points
Comment Utility
if (is_string("23"))
0
 
LVL 39

Expert Comment

by:Pratima Pharande
Comment Utility
<?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
 
LVL 3

Author Closing Comment

by:Unimatrix_001
Comment Utility
:)
0

Featured Post

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article discusses four methods for overlaying images in a container on a web page
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now