Re: Getting warning using split
| From: | Steve Edberg | Date: | Tue, 23 Jan 2001 14:19:47 +0000 |
| Subject: | Re: Getting warning using split | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-36192@lists.php.net to get a copy of this message | ||
At 7:33 AM -0500 1/23/01, Brian Clark wrote:
Hello Matt, (MW == "Matt Williams") matt@yewlands.com writes: MW> $query_string = split("+",$search); $query_string = explode('+', $search); -BrianJust to explain the error - split() takes a regular expression for its first argument; '+' is a special character for regular expressions, and is not valid by itself. That's why you're getting an error. For more info on regular expressions, there have been links to good tutorials that pop up from time to time on this list; also, I think there are a few references mentioned in the online docs for the ereg_ and preg_ functions. You can also get the O'Reilly book 'Mastering regular expressions.' That being said, though, explode() is probably a better function to use here. If you don't need the functionality of regexps, explode() is faster. -steve -- +--- "They've got a cherry pie there, that'll kill ya" ------------------+ | Steve Edberg University of California, Davis | | sbedberg@ucdavis.edu Computer Consultant | | http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ | +-------------------------------------- FBI Special Agent Dale Cooper ---+