RE: TPN POSSIBLE SPAM:Re: [PHP-WIN] Re: Problems with fscanf [WORKAROUND] fgetc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



German,

 

You can access the characters of a string one at a time using the syntax 



$myString{$i}

So I was suggesting getting the data into a string and iterating over the string using this syntax rather than repeatedly calling fgetc.

 

The chances are that it would be faster - it rather depends on how fgetc is implemented (which I don't know in PHP).


Cheers

 

AJ

 

Alexander J Turner Ph.D. 
HYPERLINK "http://www.deployview.com"www.deployview.com
HYPERLINK "http://www.nerds-central.blogspot.com"www.nerds-central.blogspot.com
HYPERLINK "http://www.project-network.com"www.project-network.com

   _____  

From: German Piqué [mailto:extremdur2@xxxxxxxxx] 
Sent: 29 September 2006 11:35
To: Alex Turner
Cc: php-windows@xxxxxxxxxxxxx; Stanislav Malyshev
Subject: TPN POSSIBLE SPAM:Re:  Re: Problems with fscanf [WORKAROUND] fgetc

 

mmm... let me guess...

 

you're saying that I must do something like this:

 

$argo = fgets($fileID,sizeof($file))

 

And then work with the string?

 

What do you mean by "using {} syntax"? Are you talking about regular expressions or what?

 

Thanks.

 

2006/9/28, Alex Turner <HYPERLINK "mailto:aturner@xxxxxxxxxxxxxxxxxxx"aturner@xxxxxxxxxxxxxxxxxxx>: 

Stanislav Malyshev wrote:
> German Piqué wrote:
>> Well, I managed to work with the spaces but using fgetc instead of 
>> fscanf.
>>
>
> Just as a note I think it would be much more efficient to use fgets or
> fread and then parse resulting string using regular expressions. Unless
> you have some limitations that weren't mentioned. 
> Just as a note I think it would be much more efficient to use fgets or
> fread and then parse resulting string using regular expressions.
> Unless you have some limitations that weren't mentioned.

That got me thinking - how about using fgets then running over the
string using {} syntax.  The same code (almost) would run many many
times faster (probably).

AJ

--
HYPERLINK "http://www.deployview.com"www.deployview.com
HYPERLINK "http://www.nerds-central.com"www.nerds-central.com
HYPERLINK "http://www.project-network.com"www.project-network.com

--
PHP Windows Mailing List (HYPERLINK "http://www.php.net/"; http://www.php.net/)
To unsubscribe, visit: HYPERLINK "http://www.php.net/unsub.php"http://www.php.net/unsub.php

 

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.9/458 - Release Date: 27/09/2006


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.9/458 - Release Date: 27/09/2006
 

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux