I have my seo url such as
at the tail of string there is a number represented an id, which I need it for DB processing, how can I separate and get the last id? I cannot use explode because it may have long string parameter with 'dash'.
thanks.
I have my seo url such as
at the tail of string there is a number represented an id, which I need it for DB processing, how can I separate and get the last id? I cannot use explode because it may have long string parameter with 'dash'.
thanks.
You can do this with:
$url = 'http://domain.com/product/export-your-url-with-21665223';
$id = substr($url, strrpos($url, '-') + 1);
echo $id;