Re: Array wildcard?
| From: | CC Zona | Date: | Thu, 25 Apr 2002 18:50:39 +0000 |
| Subject: | Re: Array wildcard? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94623@lists.php.net to get a copy of this message | ||
In article <B8EDBF9C.CBB4%eurleif@buyer-brokerage.com>,
eurleif@buyer-brokerage.com (Leif K-Brooks) wrote:
> One more question. Is there any way to use this with part of a string?
> Example:
> function checkfruitlove($string){
> $fruitarray = array("apples","oranges");
> if($string == "I love ".in_array($fruitarray)."!"){
> $return = "I do too!";
> }else{
> $return = "I don't!";
> }
> return $return;
> }
> $answer = chechfruitlove("I love apples!"); //returns "I do too!"
> $answer = chechfruitlove("I love oranges!"); //returns "I do too!"
> $answer = chechfruitlove("I love pears!"); //returns "I don't!"
<http://php.net/preg-match>
--
CC