note 36579 added to function.strpos
| From: | laurent at atanis dot net | Date: | Wed, 15 Oct 2003 13:13:37 +0000 |
| Subject: | note 36579 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58630@lists.php.net to get a copy of this message | ||
English :
To find a string content between to other in another string and use strpos() and substr();
--
French :
Pour trouver une chaine de caractères située entre deux chaines dans une chaine globale ou un
texte en utilisant strpos() et substr().
--
The function !
function FirstFind($start_string,$end_string,$content)
{
$str_pos1 = strpos($content,$start_string);
$str_pos2 = strpos($content,$end_string,$str_pos1);
$str_diff = $str_pos2-$str_pos1;
if($str_pos1 != false)
{
$string = substr($content,$str_pos1,$str_diff);
return $string;
}
else
{
return false;
}
}
This function return the string content between $start_string and $end_string, she return false if
the start_string is not find in $content.
Cette fonction retourne la chaine située entre $start_string et $end_string si $start_string est
trouvée dans $content.
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36579
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36579&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36579&report=yes
Search -- http://master.php.net/manage/user-notes.php