This is a discussion on fscanf question within the alt.comp.lang.php forums, part of the PHP Programming Forums category; In php5 I'm trying to read in a float number from an ascii file with: $n = fscanf($fp, "%...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
In php5 I'm trying to read in a float number from an ascii file with: $n = fscanf($fp, "%f", $f); where the ascii file contains this: "....> 1.32405 </FONT></TD>" I use fseek to go to the offset of the single space before the number and then use fscanf. But I'm not reading the number correctly. What is the best way to get the float into php? thanks, Sam |
|
|||
|
Sam Waller schrieb:
> In php5 I'm trying to read in a float number from an ascii file with: > > $n = fscanf($fp, "%f", $f); from this line I cannot tell what you are doing. > > where the ascii file contains this: > > "....> 1.32405 </FONT></TD>" > > I use fseek to go to the offset of the single space before the number and then use fscanf. But I'm > not reading the number correctly. What is the best way to get the float into php? fscanf is fine or a regular expression might do > > thanks, > Sam > |