RES: [PHP-WIN] How to check if a *string* has only numbers...
| From: | Rafael Soares | Date: | Wed, 17 Nov 2004 01:47:07 +0000 |
| Subject: | RES: [PHP-WIN] How to check if a *string* has only numbers... | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-24984@lists.php.net to get a copy of this message | ||
> 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: Larry E. Ullman [mailto:LarryUllman@DMCInsights.Com]
Enviada em: terça-feira, 16 de novembro de 2004 23:42
Para: Rafael Soares
Cc: php-windows@lists.php.net
Assunto: Re: [PHP-WIN] How to check if a *string* has only numbers...
> I would like to check if a string contains only numbers, I really cant
> 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 = $dataParts[3];
should probably be $dataP3 = $dataParts[2];
Larry