R4R Team working to provide free of cost for experienced and freshers

Tutorials | Examples|Interview Questions and Answers|Java Tutorials| C Tutorials | C++ Tutorials | Spring Tutorials| Hibernate Tutorials | JSP Tutorials | Servelets Tutorials| C# Tutorials | PHP Tutorials etc , Basics | Download Software | Data Types | Variables | Constant | Storage & Classes | Operators | Decisions Making | Loops | Functions| Numbers | Arrays | Pointers | String | Datastructure | Expressions | Preprocessor Statement | I/O | Exception Handling | OOPs Tutorial | Classes and object |C++ Inheritance Overloading | Polymorphism | Abstraction | Encapsulation | Interfaces | Multithreading etc

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