How to remove portion of a string after a certain character in PHP?
With the help of PHP substr() and strops() functions, we can remove the portion of a string after a certain character.
It is an inbuilt function of PHP which searches a particular piece of text in a string and returns the first occurrence of that text.
It is also an inbuilt function of PHP which returns the part of a string by position.
We find the part of a string after a certain character with the help of above both functions.
?php $string="coding-tag"; $position=strpos($string, "-"); $result=substr($string,intval($position)+1); echo $result; ?
SEMRush FREE Trial – PRO Account for 14 Days
FREE Pro Account worth $99.95 for 14 Days.
Waiting for your comments