PHP strpos a searching function

strpos() is a very usefull php function that will find a string into another string.

This function takes two parameters: the string your are searching in and the string you are searching for, and it returns the position of the first match, or false if not found.

PHP Code:
$mystring = "May 16, 1990" ;
$search = "19" ;
$pos = strpos(
$mystring , $search ) ;
echo $pos ;
Display:
8
Note:
PHP Start from 0, so the first position is position 0 , the second is 1 ...

The searched string may also be a character, or a number that will be considered as an ASCII code of the searched character.

1 comments:

Guild Wars 2 Gold said...

Such a nice post, My spouse and i loved this a good deal! I like your fashion sense! Fantastic photos! cheap Guild wars 2 Gold


RS Gold