Re: Why don't ...

From: Date: Sun, 16 Dec 2001 18:54:38 +0000
Subject: Re: Why don't ...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-77875@lists.php.net to get a copy of this message
At 09:14 AM 12/16/2001 -0500, Yoel Benitez Fonseca wrote:
Hi! The following code fragment tries to read a sequence of digits from a file but it doesn't work, only the first character is read, Which is my error?.
           $str = "";
           while( ($c = fgetc($this->m_file)) && ereg("[0-9]", $c) ){
               $str .= $c;
           }
What happens when you do just this: $str = ""; while($c = fgetc($this->m_file)){
        $str .= $c;
} Does it still only read the first character?

« previous php.general (#77875) next »