I need to split a string in PHP by \"-\" and get the last part.
So from this:
abc-123-xyz-789
I expect to get
Just check whether or not the delimiting character exists, and either split or don't:
if (strpos($potentiallyDelimitedString, '-') !== FALSE) { found delimiter, so split }