Showing posts with label PHP strpos Function Tutorial. Show all posts
Showing posts with label PHP strpos Function Tutorial. Show all posts

Monday, April 30, 2012

PHP strpos Function Tutorial


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
<?php
   echo strpos("Hello world!","world");
?>
Output
6
The position of the data world in our string is position 6. 
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';
       echo strpos($string, $find);
?>
Output
18