Re: Extract data
| From: | J Smith | Date: | Tue, 04 Dec 2001 19:23:03 +0000 |
| Subject: | Re: Extract data | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76582@lists.php.net to get a copy of this message | ||
For a split this simple, I'd recommend using explode("|", $data). split()
uses a regex for the first character (and as others have said, the pipe is
a metacharacter in a regex, so you'll need to use "\|" instead of "|"),
whereas explode() is simply literal. explode() will probably be slightly
faster, too, since it doesn't need to compile the regex, etc., although the
difference will probably be infintesimal.
J
Dan wrote:
> Hello guys
>
> I'm making poll script that stores data like this:
>
> 0|0|0|0|0
>
>
>
>
> But i'm getting this error all the time:
>
> Warning: unexpected regex error (14) in c:\program files\apache
> group\apache\htdocs\eztatic\poll.php on line 25
>
> 25: list(q1,q2,q3,q4,q5)= split ("|", $answer, 5);
>
>
> Could any help
>
> Thank you very much in advance
>
>