Web Development PHP Programming - Learn PHP
 Developer Newsletter

Developer Tutorials
ASP
CGI & Perl
CSS
Flash
HTML
Java
JavaScript
Linux
MySQL
PHP
Photoshop
Python
Wireless
XML


Developer Manuals
Learn HTML
Learn PHP
Learn CSS
Learn Pear
Free White Papers



Scripts Directory
ASP Scripts
ASP.NET Scripts
CGI & Perl Scripts
Flash Scripts
Java Scripts
JavaScript Scripts
PHP Scripts
Python Scripts
Remotely Hosted Scripts
Tools & Utilities Scripts
XML Scripts

Web Hosting Directory
ASP.NET Hosting
Budget Web Hosting
Dedicated Servers
Linux Web Hosting
Shared Hosting
Small Business Hosting
Windows Web Hosting

Developer Resources
Developer Tools
Developer News
Developer Content
Developer Book Reviews
Survey Software




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.

Parameters

haystack

needle

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

needle and haystack are examined in a case-insensitive manner.

Return Values

Returns the matched substring. If needle is not found, returns FALSE.

Examples

Example 1. stristr() example

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

Example 2. Testing if a string is found or not

<?php
  $string
= 'Hello World!';
  if(
stristr($string, 'earth') === FALSE) {
    echo
'"earth" not found in string';
  }
// outputs: "earth" not found in string
?>

Example 3. Using a non "string" needle

<?php
  $string
= 'APPLE';
  echo
stristr($string, 97); // 97 = lowercase a
// outputs: APPLE
?>

Notes

Note: This function is binary-safe.







About the NetVisits, Inc Network | Advertise
Developer Tutorials hosted by HostGator.
Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy.
Visit other NetVisits, Inc. sites: