strpos Function
1. strpos function allows to find data in a particular string.2. If a match is found in the string, strpos function will return the position of the first match. If no match is found, it will return FALSE.
Example: 1
<?phpecho strpos("Hello world!","world");
?>
Output
6
The position of the data world in our string is position 6.
Because, strops starts count from zero.
Because, strops starts count from zero.
Example: 2
<?php
$string = 'I will develop my wisdom and intuition. I will realize my infinite potential fully.';
$find= 'wisdom';
$find= 'wisdom';
echo strpos($string, $find);
?>
Output
18
No comments:
Post a Comment