- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
strchr() function in PHP
The strchr() function is used to search for the first occurrence of a string inside another.
Note − This function is case-sensitive.
Syntax
strchr(str, search, before_search)
Parameters
str − The string to search
search − The string to search for
before_search − If TRUE, the function returns the part of the str before the first occurrence of the $search
Return
The strchr() function returns the rest of the string from the matching point. FALSE, if the string to search for is not found.
Example
The following is an example −
<?php echo strchr("Demo text!","text"); ?>
Output
text!
Example
The following is an example −
<?php $str= "This is demo text!"; $findStr = "demo" ; echo strchr($str, $findStr, true); ?>
Output
This is
Advertisements
To Continue Learning Please Login
Login with Google