Return substring of a string in php

I want to remove string from a string from end.

for example I have a php string variable "SomeText1|SomeText2|SomeText3|SomeText4|SomeText5|SomeText6" and i want value "SomeText1|SomeText2|SomeText3|SomeText4|SomeText5" in PHP.

I tried using strrpos() to get the last occurrence of "|" i got index now i am stuck how to process further

Every time i want string excluding the last occurrence of “|” followed by the text.

Source: php

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.