is there a way to use explode function to explode only by last delimiter occurrence?
$string = "one_two_ ... _three_four"; $explodeResultArray = e
There is no need for a workaround. explode() accepts a negative limit.
explode()
$string = "one_two_three_four"; $part = implode('_', explode('_', $string, -1)); echo $part;
Result is
one_two_three