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 Reply

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