Re: Re: fscanf

From: Date: Wed, 22 Jan 2003 00:02:26 +0000
Subject: Re: Re: fscanf
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-132525@lists.php.net to get a copy of this message
I've tried $array = fscanf ($fp, "%s, %s, %s\n"); earlier. It picks up array[0] == text, I need array[0] == text array[1] == text array[2] == text Thanx K ----- Original Message ----- From: "Jason k Larson" <jlarson@candlefire.org> To: "Kris" <kreid2@bigpond.net.au> Cc: <php-general@lists.php.net> Sent: Wednesday, January 22, 2003 9:52 AM Subject: Re: [PHP] Re: fscanf > I think he is looking more for: > $array = fscanf ($fp, "%s, %s, %s\n"); > > But with split, wouldn't that need to be: > > $array = split(', ', $line); > > http://www.php.net/manual/en/function.split.php > or > > $array = preg_split ('/[\s,]+/', $line); > using: http://www.php.net/manual/en/function.preg-split.php > > HTH, > Jason k Larson > > > Philip Hallstrom wrote: > > Why not: > > > > $array = split("[ ,]", $line); > > > > ? > > > > On Wed, 22 Jan 2003, Kris wrote: > > > > > >>Hi > >> > >>I'm having dramers with fscanf > >>I have a line: > >>text, text, text > >> > >>I can't work out how to scan removing the comma and whitespace. > >>the text can be absolutle anything. > >> > >>at the moment I have > >>$array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); > >> > >>Thanks > >> > >>Kris > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#132525) next »