PHP/String/stristr

Материал из Web эксперт
Версия от 10:07, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Detecting whether a string is contained in another string

   <source lang="html4strict">

<?php $password="secretpassword1"; if (strstr($password,"password")){

   echo("Passwords cannot contain the word "password".");

} else {

   echo ("Password accepted.");

} ?>

 </source>
   
  


Using Substring Alternatives

   <source lang="html4strict">

//string strstr ( string haystack, string needle ) //string stristr ( string haystack, string needle ) <?php $url = "www.wbex.ru"; $domain = strstr ($url, "."); echo $domain; ?>

 </source>