note 36579 deleted from function.strpos by didou

From: Date: Wed, 15 Oct 2003 17:22:10 +0000
Subject: note 36579 deleted from function.strpos by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-58642@lists.php.net to get a copy of this message
Note Submitter: laurent@atanis.net ---- 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.

« previous php.notes (#58642) next »