473,322 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

isNumber function?

Hello, I'm using PHP 4 and I was wondering if there was a function, or
an easy way to check if a variable is a number. THe "intval" function
doesn't work very well for me because if the variable is "abc" or "0",
the same value is returned. I would prefer a function that tells me
"abc" is not a number and "0" is a number.

Thanks, - Dave

Jul 17 '05 #1
2 37975
la***********@zipmail.com wrote:
Hello, I'm using PHP 4 and I was wondering if there was a function, or
an easy way to check if a variable is a number. THe "intval" function
doesn't work very well for me because if the variable is "abc" or "0",
the same value is returned. I would prefer a function that tells me
"abc" is not a number and "0" is a number.


Would IsNumeric() fit the bill?

Cheers,
Nicholas Sherlock
Jul 17 '05 #2
Just in case you didn't find it yet... it's is_numeric() ;-)

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Rainer Deyke | last post by:
Now that rexec is gone, is there any code or information available on executing Python in a restricted environment? And before I roll my own solution, exactly where the security holes in rexec...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
5
by: phil_gg04 | last post by:
Dear Javascript Experts, Opera seems to have different ideas about the visibility of Javascript functions than other browsers. For example, if I have this code: if (1==2) { function...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
2
by: sushil | last post by:
+1 #include<stdio.h> +2 #include <stdlib.h> +3 typedef struct +4 { +5 unsigned int PID; +6 unsigned int CID; +7 } T_ID; +8 +9 typedef unsigned int (*T_HANDLER)(void); +10
2
by: Jefe | last post by:
Hi Group Could you please explain to me what's the difference between Chars.IsDigit and Chars.IsNumber? Regards,
8
by: Olov Johansson | last post by:
I just found out that JavaScript 1.5 (I tested this with Firefox 1.0.7 and Konqueror 3.5) has support not only for standard function definitions, function expressions (lambdas) and Function...
4
by: sang | last post by:
I am trying to get the number that are present in the input string by using the isNumber(), but i have no idea about that any one help me. input for the program is "java123" output is only "123"...
3
by: MooMaster | last post by:
N00b question alert! I did a search for isdigit() in the group discussion, and it didn't look like the question had been asked in the first 2 pages, so sorry if it was... The manual...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.