Well, since is_numeric('.101972E+00') works on it's own, there must be
something else coming with it from the file that makes it fail. Try to
trim() each number before you test it. Maybe that'll help.

---John Holmes...

----- Original Message -----
From: "fmendezpalma" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 07, 2003 7:29 AM
Subject: [PHP] is_numeric fails and don't know why


Hi,

I'm trying to read a file that contains a group of numbers, each of them in
one line of the file. I need to verify that the file is valid, so i read
line by line and test if the line is numeric:

...

$line = fgets ($FileDesc);
$line = trim ($line);
if (!is_numeric ($line))
   return 0;

...

It doesn't work for the first and last line of the file. Last line is a \r,
so perhaps it's normal, but I don't understand why it fails with first line.

Example:

.101972E+00     (first line)
-.122713E+01
.784379E-01
-.135826E+01
-.217017E+01

... first line is not considered as a number. Rest of lines are considered
as numbers. Where is the problem? Thanks for your help.
_____________________________________________________________________
Horas ilimitadas para leer y enviar correos con Tarifa Plana Wanadoo
¡¡ desde las 3 de la tarde!!
Compruébalo en http://www.wanadoo.es/acceso-internet


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to