(originally posted to php-db, but I realized that this list is far more germane
for the question - apology to those reading it twice).
I don't even know if this is possible, or if I'll have to go the route of .NET
development to get this sort of functionality (I'm sure it's possible if I jump
thro
Hello people!!!
I would like to check if a string contains only numbers, I really cant
realize how to do it.
I tried is_int(), but it dont work because the variable is a string (I used
gettype() to check it) and is_int() returns NULL
It is to validate some data in a form. The variabl
I would like to check if a string contains only numbers, I really can’t
realize how to do it.
is_numeric()
$data = $_POST[‘data’]; // something like 123.456.789
$dataParts = explode($data);
//these are the variable I have to check:
$dataP1 = $dataParts[0];
$dataP2 = $dataParts[1];
$dataP3 = $dataPa
> is_numeric()
Thanks, it works so fine.
> should probably be $dataP3 = $dataParts[2];
The script in the email has some other errors, I wrote that as an example.
The original script is OK.
Thank you very much.
Rafael Soares - AgênciaM
Fone: +55 11 4616-1394
-Mensagem original-
De:
You can try
if (ereg('[^0-9]',$value))
{
do something // if you form value string contains non numerics do
something
}
else
{
settype($value,"integer"); // Its a numeric so set the string to a
integer to allow normal < > etc testing.
}
Mike
- Original Message -