It finds the last occurrence of a character in a string
Example
<?php
echo strrchr(“phpcodeccr”,”co”);
?>
Output
cr
It finds the last occurrence of a character in a string
Example
<?php
echo strrchr(“phpcodeccr”,”co”);
?>
Output
cr
It finds the position of the first occurrence of a substring in a string
Example
<?php
echo strpos(“phpcode”,”co”);
?>
Output
3
It searches a string for any of the specified characters.
Example
<?php
echo strpbrk(“phpcode”,”co”);
?>
Output
code
It compares first n characters (case-sensitive) of a strings
Example
<?php
echo strncmp(“phpcode”,”codez”,7);
?>
Output
1
It compares two strings
Example
<?php
echo strncasecmp(“phpcode”,”codez”,7);
?>
Output
13
It compares two strings using a “natural” algorithm.
Example
<?php
echo strnatcmp(“PHPCode”,”PHPCodez”);
?>
Output
-1
It compares two strings using a “natural” algorithm.
Example
<?php
echo strnatcasecmp(“PHPCode”,”PHPCodez”);
?>
Output
-1
It find the string length
Example
<?php
echo strlen(‘info@phpcodez.com’);
?>
Output
17
It find the first occurrence of a string(case insensitive)
Example
<?php
echo stristr(‘info@phpcodez.com’, ‘@’, true);
?>
Output
info
It removes backslashes added by the addslashes() function.
Example
<?php
echo stripslashes(“phpcode”);
?>
Output
phpcode