超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<stripslashesstrlen>
Last updated: Fri, 22 Jun 2007

stristr

(PHP 3>= 3.0.6, PHP 4 , PHP 5)

stristr --  Case-insensitive strstr()

Description

string stristr ( string haystack, string needle)

Returns all of haystack from the first occurrence of needle to the end. needle and haystack are examined in a case-insensitive manner.

If needle is not found, returns FALSE.

If needle is not a string, it is converted to an integer and applied as the ordinal value of a character.

例子 1. stristr() example

<?php
  $email
= 'USER@EXAMPLE.com';
 
$domain = stristr($email, 'e');
  echo
$domain;
// outputs ER@EXAMPLE.com
?>

注: 该函数适用于二进制对象!

See also strstr(), strrchr(), substr(), and ereg().




add a note add a note User Contributed Notes
stristr
dan at mojavelinux dot com
20-Apr-2002 07:25
Watch out on this function if you are searching for a '0' as the last character.  If you string is,

$total = "Your total is 0";

and you do

if (stristr($total, '0')) {
   echo "you have nothing";
}

it will not echo anything.

<stripslashesstrlen>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22