Re: substr function...
| From: | David Robley | Date: | Thu, 26 Oct 2000 02:41:40 +0000 |
| Subject: | Re: substr function... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22021@lists.php.net to get a copy of this message | ||
On Thu, 26 Oct 2000, Javier Morquecho Morquecho wrote:
> I have problem with the substr function, I now it looks very, very simple,
> but I guess my brain is't working today at all...
> this is the code...
>
> $inicio=1;
> $long=10;
> while (!feof($file)) {
> $line = fgets($file, 1024);
> echo "--$line--";
> $x=substr($line, $inicio, $long);
> echo "</br>El substring desde $inicio con longitud $long es *$x*";
> echo "</br>";
>
> --SID = 9269115590 --
> El substring desde 1 con longitud 10 es *ID *
> --SID = 6567197997 --
> El substring desde 1 con longitud 10 es *ID *
> --SID = 6269193575 --
>
> I'm expecting
> *ID = 92691*
> *ID = 62691*
>
> What's going on ??...
The code looks right for what you are trying to do. Does looking at the
source give any clues?
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA