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

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

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

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>