Try this
print str_replace('index.php/','',strstr ( $url , 'index.php'));
Question
I am have a string having url
/abc/xyz/index.php/pqr/wer
I want the result as path after index.php*
i.e;
pqr/wer
to be stored in a variable
I did try with
Preg_match,trim,split,substring
split splits it but then how do i get path after index.php
what if i have
$url =/abc/xyz/index.php
it return index.php
La solution
Try this
print str_replace('index.php/','',strstr ( $url , 'index.php'));
Autres conseils
Use preg_match
to get the string following index.php
:
preg_match( '/index.php\/(.*)/i', '/abc/xyz/index.php/pqr/wer', $arMatches );
print_r( $arMatches );
Outputs:
Array ( [0] => index.php/pqr/wer [1] => pqr/wer )
$arMatches[1]
is what you want.