• PHP Video Tutorials

PHP - Function Stristr



Syntax

string stristr ( string $haystack , mixed $needle [, bool $before_needle = false ] )

Definition and Usage

It is used searches for the first occurrence of a string inside another string.

Return Values

It returns rest of the string or else string is not found

Parameters

Sr.No Parameters & Description
1

string

It is used to specifies the string to search

2

search

It is used to specifies the string to search for

Example

Try out the following example

<?php
   echo stristr("sairam krishna","krishna",true);
?>

This will produce following result −

sairam
php_function_reference.htm
Advertisements