get_last_part()

function get_last_part(string $str, string $delimiter = '-'): string

Description

Retrieves the last part of a string after splitting it on a given delimiter. This is useful for extracting slugs, IDs, or file extensions from structured strings.

Parameters

Parameter Type Description Default
$str string The input string to retrieve the last part from. N/A
$delimiter string The delimiter used to split the string. '-'

Return Value

Type Description
string The last part of the input string.

Example Usage