The strstr function in PHP is used to return all characters of a string after the first match. The syntax of the strstr function is:
strstr ('string', 'match_pattern', [before_indicator])
If the optional before_indicator parameter is set to TRUE, the strstr function returns all characters of a string before the first match. before_indicator is introduced in PHP 5.3.0.
Let's take a look at the examples below:
Example 1
print strstr ('PHP strstr function','str');
Result:
strstr function
Example 2
print strstr('PHP strstr function','str', TRUE);
Result:
PHP
If you like this please Link Back to this article...
0 comments:
Post a Comment