
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
strstr() function in PHP
The strstr() function is used to find the first occurrence of a string.
Note − The function is case-sensitive.
Syntax
strstr(str,search,before)
Parameters
str − The string to search
search − The string to search for
before − 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.
Return
The strstr() function returns the rest of string or false if the string is not found.
Example
The following is an example −
<?php echo strstr("Brad Pitt!", "a"); ?>
Output
ad Pitt!
Example
The following is an example −
<?php echo strstr("Brad Pitt!", "a", true); ?>
Output
Br
- Related Questions & Answers
- strstr() function in C/C++
- What is strstr() Function in C language?
- strstr() in C++
- Implement strStr() in Python
- file_exists() function in PHP
- basename( ) function in PHP
- chgrp()function in PHP
- chmod() function in PHP
- chown() function in PHP
- clearstatcache() function in PHP
- copy() function in PHP
- delete() function in PHP
- dirname()function in PHP
- disk_free_space() function in PHP
- disk_total_space() function in PHP
Advertisements