PHP/String/String Find — различия между версиями

Материал из Web эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 10:37, 26 мая 2010

Finding a Substring Within a String with strstr()

<?
$membership = "pAB7";
if ( strstr( $membership, "AB" ) )
   print "Thank you. Don"t forget that your membership expires soon!";
else
   print "Thank you!";
?>



String find Demo

<?
$string_to_search = "showsuponceshowsuptwice";
$string_to_find = "up";
print("Result of looking for $string_to_find" . strstr($string_to_search, $string_to_find));
$string_to_find = "down";
print("Result of looking for $string_to_find" . strstr($string_to_search, $string_to_find));
?>