Jump to content


Photo

question


  • Please log in to reply
1 reply to this topic

#1 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 20 September 2006 - 07:28 PM

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???

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#2 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 20 September 2006 - 07:49 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users