Blog Details

how to get position from string in php



                                

* PHP strrpos() Function :-

  • The strrpos() function finds the position of the last occurrence of a string inside another string.
 
  • strpos() - Finds the position of the first occurrence of a string inside another string (case-sensitive)
  • stripos() - Finds the position of the first occurrence of a string inside another string (case-insensitive)
  • strripos() - Finds the position of the last occurrence of a string inside another string (case-insensitive)
 

Syntax :

strrpos(string,find,start)

Example :

<html> <body> <?php echo strrpos("I love php, I love php too!","php");   //first occurance of a string echo strpos("I love php, I love php too!","php");    //first occurance of a string echo stripos("I love php, I love php too!","php");   //last  occurance of a string ?> </body> </html>

Output :

8 8 19


Categories

Core_PHP

Latest posts

13.05.14
Implementing CRUD Operations ¶

<ul> <li>Now comes the fun part. We would like t

13.05.14
View

<ol> <li><a href="http://www.yiiframework.com/do

13.05.14
Creating Model

<ol> <li><a href="http://www.yiiframework.com/do

Get Free Quote