TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-06-2008, 08:30 AM   #1 (permalink)
The Contributor
 
Join Date: May 2008
Location: Iran
Posts: 53
Thanks: 33
Yoosha is on a distinguished road
Help is_numeric($X) V.S. ctype_digit($X) V.S. is_integer($X)

Hi,
What is difference between is_numeric($X) V.S. ctype_digit($X) V.S. is_integer($X)?
Tnx ;).
Send a message via Yahoo to Yoosha
Yoosha is offline  
Reply With Quote
Old 09-06-2008, 09:16 AM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

The relevant PHP Manual pages (is_numeric, ctype_digit, is_integer) should provide a clear answer, but in short:
  • is_numeric checks if the argument has a numerical value (e.g. 123, "0xFF" [hexadecimal], 0123 [octal], "+012.345e6", 3.14 are all allowed)
  • ctype_digit checks if all of the characters in a string are digits (e.g. 12345 is ok, 3.14 is not [the decimal point is not a digit!])
  • is_integer (and is_int) checks if the argument is an integer (i.e. 23 is ok, "23" is not)
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
Yoosha (09-06-2008)
Old 09-06-2008, 11:26 AM   #3 (permalink)
The Contributor
 
Join Date: May 2008
Location: Iran
Posts: 53
Thanks: 33
Yoosha is on a distinguished road
Default

Very thanks. Resolved ;).
Send a message via Yahoo to Yoosha
Yoosha is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 07:28 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design