Fw: [PHP] Null character as field seperator in a string.
| From: | The_RadiX | Date: | Tue, 30 Apr 2002 08:18:59 +0000 |
| Subject: | Fw: [PHP] Null character as field seperator in a string. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-95339@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "The_RadiX" <the_radix@hotkey.net.au>
To: <php-general@lists.php.net>; "Dave MacRae" <dave@datacash.com>
Sent: Wednesday, January 24, 2001 10:05 PM
Subject: Re: [PHP] Null character as field seperator in a string.
> Hey..
>
> yeah I might..
>
>
> I don't know if I am right or just blabbering crap
>
> but try to add these param's to your regex statement..
>
>
> preg_split("/\0/i", $buffer);
>
>
> note the i.. It should let it read past newlines.. although you're prob is
> with null (\0) chars..
>
>
> as I said.. Don't know if I am on the right track.. but it's worth a go
eh??
>
>
>
>
>
> good luck..
>
> ----- Original Message -----
> From: "Dave MacRae" <dave@datacash.com>
> To: <php-general@lists.php.net>
> Sent: Monday, April 29, 2002 8:26 PM
> Subject: [PHP] Null character as field seperator in a string.
>
>
> > For historic reasons, I have a file that contains a number of records in
> > which the fields are seperated by the NULL character, i.e,
> >
> > field1\0field2\0field3\0field4
> >
> > I need to parse out the fields from this string.
> >
> > The string is read into the program using
> >
> > $buffer = fgets(...).
> >
> > This would be no problem in Perl or C but I cannot get this to work in
> PHP.
> >
> > I have tried using
> >
> > preg_split("/\0/", $buffer);
> >
> > But this fails. I've tried walking through the string but it seems that
> > $buffer only has the content up to the first NULL character.
> >
> > Does anyone have a simple solution to this problem.
> >
> > Regards
> >
> > Dave
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>