For products:
mysite.com/my-product-number-one-p-34323.html
mysite.com/my-product-number-two-p-34324.html
For categories:
mysite.com/my-category-one-c-15.html
mysite.com/my-category-two-c-16.html
For reviews:
mysite.com/my-review-one-pr-234.html
mysite.com/my-review-two-pr-235.html
Anyway, my script is determining which type of url it is based on the presence of -p-, -c-, or -pr- in the url string. However, I am concerned that I might eventually encounter a URL like the following that has multiple matches:
mysite.com/my-product-vitamin-c-p-34234.html
so I want a php/regex function that returns the last occurrence of a matching string. Right now I'm using the following regex code to identify the matches:
Code: Select all
"(-c-|-p-|-pr)"I'd love to call something like:
Code: Select all
$page_type=preg_last_string_occurence("(-c-|-p-|-pr)", $url);Thanks for any help you can provide!