Re: strpos with array?
| From: | Burhan Khalid | Date: | Thu, 12 May 2005 09:43:23 +0000 |
| Subject: | Re: strpos with array? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215030@lists.php.net to get a copy of this message | ||
Merlin wrote:
Burhan Khalid wrote:1. All functions in PHP are lowercase. Do not UPPERCASE your functions. Its Just Not Right. 2. You should always pass a full url (ie, with the scheme and host) to the Location header. 3. You need a space after Location: 4. There is no need for ."" at the end of your Location: string.Merlin wrote:Actually this did not solve the problem, since this function is searching for the exact phrase, but not within a string. I solved it that way:Hi there, I am wondering if there is a function (I could not find) which does the same thing like strpos does, but with an array. For example:$replace = array("picture", "pics"); $pos = strpos ($term, $replace); //if ($pos !== false) {if (in_array($term,$replace)) {http://www.php.net/in_array$term = str_replace($replace, "", $term); echo 'term without the word:'.$term; }// try pictures $replace = array("pictures", "picture", "bilder", "bild", "pic", "pics", "pix"); foreach($replace AS $try){ $pos = strpos ($term, $try); if ($pos !== false) { $term = str_replace($try, "", $term); #echo 'yes'.$term.$pos; exit; HEADER("Location:/index.php?search_for=".$term.""); exit;