Get the portion of a string after the last occurrence of a character

Here’s a quick php snippet to get a substring after a specific character. In this example, it gets everything after the “_”.

substr(strrchr($fieldname, "_"), 1);

 

Leave a comment

Your email address will not be published. Required fields are marked *

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