It finds the position of the last occurrence of a substring in a string
Example
<?php
echo strrpos(“phpcodeccr”,”p”);
?>
Output
2
It finds the position of the last occurrence of a substring in a string
Example
<?php
echo strrpos(“phpcodeccr”,”p”);
?>
Output
2
It find the position of the last occurrence of a substring in a string(case-insensitive)
Example
<?php
echo strripos(“phpcodeccr”,”c”);
?>
Output
8
It reverse a string
Example
<?php
echo strrev(“phpcodeccr”);
?>
Output
rccedocphp
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