PHP Programing language

strchr() Function in PHP
Previous Home Next

strchr()

The strchr() function searches for the first occurrence of a string inside another string.

Syntax:
strchr(string,search,before_search);

In above syntax, "string" specifies the string to search, "search" specifies the string to search for. If this parameter is a number, it will search for the character matching the ASCII value of the number and "before_search" is a boolean value whose default is "false". If set to "true", it returns the part of the string before the first occurrence of the search parameter.

Example:

<?php
echo strchr("Hello world! <br/>",101);
echo strchr("Hello world!","world");
?>

 

Output:

ello world! 
world!

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: