Jump to content

Archived

This topic is now archived and is closed to further replies.

Ninjakreborn

question

Recommended Posts

Is there a way for me to test something. like if I have an input, I need to make sure it's a number, I can do this with
is_number($variable);
it will tell me if it's a number, that's easy, but then I have to check to see if it's got the $ symbol in front of it, if it doesn't then I need to put one there, if it does then I need to leave it alone, how can I do this???

Share this post


Link to post
Share on other sites
actually if I just use
if (!is_numeric($variable)) {
echo "$variable has to be a number, please go back and correct this";
}
Won't that guarantee that it's a number, then I can just add the dollar sign on there.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.