note 57891 added to function.strstr
| From: | info at simply-networks dot de | Date: | Tue, 18 Oct 2005 11:25:51 +0000 |
| Subject: | note 57891 added to function.strstr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97158@lists.php.net to get a copy of this message | ||
//Load a Array and select one Sting if the function STRSTR doesnt find the such word.
Enviroment Details: SuSE Linux 9.0; PHP 4
$a = array('first String','second String','Third String','more
Strings','fiveth String');
//we such all String if Word "more" isnt there
foreach ($a as $key => $data){
if(!strstr($data,"more")){ //looking for more
$select = array_shift($a);//get one from array
}
}
print_r($a);
//if you print this you have 'fiveth String' into the array
Note: if you use if(strstr($data,"more")){ ... you will get second, Third Strings!!
----
Manual Page -- http://www.php.net/manual/en/function.strstr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57891
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57891&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57891&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57891&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57891&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57891&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57891&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57891&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57891&report=yes
Search -- http://master.php.net/manage/user-notes.php