Re: Reading from file
| From: | Artur Ejsmont | Date: | Tue, 02 Nov 2010 10:08:18 +0000 |
| Subject: | Re: Reading from file | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-47470@lists.php.net to get a copy of this message | ||
"Return Values
If only two parameters were passed to this function, the values parsed
will be returned as an array. Otherwise, if optional parameters are
passed, the function will return the number of assigned values. The
optional parameters must be passed by reference."
http://php.net/manual/en/function.fscanf.php
so you should expect an array. print_r it to see what is inside.
art
On 2 November 2010 03:34, Ethan Rosenberg <ethros@earthlink.net> wrote:
> Dear List -
>
> Thank you for all your help. Here is another one.....
>
> I have a file [/home/ethan/PHP/RecNum] which consists of the number 1005.
> It also has been "1005". No matter how I do it, it is only recognized as
> 1.
>
> Here is the code. In this case, the file is "1005".
>
> $fptr1 = fopen("/home/ethan/PHP/RecNum", "r+");
> $recNum = (int)fscanf($fptr1,"%s");
> echo $recNum; //which always is 1
>
> If I do not typecast $recNum to int, the value is Array.
>
> Thanks.
>
> Ethan
>
> MySQL 5.1 PHP 5 Linux [Debian (sid)]
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Visit me at:
http://artur.ejsmont.org/blog/