Reputation: 39
I have URL of file which looks like this
movieImages/1`updateCategory.PNG
it should look like this
updateCategory.PNG
Upvotes: 0
Views: 46
Reputation:
you can use like this, simple
$string = 'movieImages/1`updateCategory.PNG';
$ser = 'movieImages/1`';
$trimmed = str_replace($ser, '', $string);
echo $trimmed;
output will be updateCategory.PNG
Upvotes: 1
Reputation: 46910
Find the position of unwanted character and then pick up the substring after that position.
$str="movieImages/1`updateCategory.PNG";
$unwanted="`";
echo substr($str,strpos($str,$unwanted)+1);
Output
updateCategory.PNG
That is if the string can vary in structure and size. If the first part will always remain same you can simply remove the unwanted stuff using str_replace
.
echo str_replace('movieImages/1`','',$str);
Upvotes: 1