stristr Function in PHP

What is stristr Function and how it is used in string?

Explanation

In PHP,this function searchs for the first occurence of a string inside another string.

Syntax:


stristr(string,search)

In the above syntax "string" specifies the string to search, "search" specifies the string to search for.

Example :


<?php
echo stristr("Hi,my name is Sam Anderson.",n);
?>
Result :

name is Sam Anderson

In the above example the string is displayed from the first occurence of the letter "n".

PHP Topics


Ask Questions

Ask Question