How do you query the data after the 4th slash in a URL?
Posted: Thu Sep 25, 2014 4:21 am
I'm sure I have asked this before, as I know I have done it - but I cannot recall where I did this.
So if the URL is:
http://www.site.com/product/445/xl/335/ ... /red-shirt
I was to know if "product" appears after that first main slash.
And then I want to query the string after the sixth slash.
If I can find the first slash and put that word into a query, or find the sixth and put that digit into a variable, I am sorted.
As I say, I've done this but no idea where. Either Explode or Pregmatch, but not sure how I count the slashes.
So if the URL is:
http://www.site.com/product/445/xl/335/ ... /red-shirt
I was to know if "product" appears after that first main slash.
And then I want to query the string after the sixth slash.
If I can find the first slash and put that word into a query, or find the sixth and put that digit into a variable, I am sorted.
As I say, I've done this but no idea where. Either Explode or Pregmatch, but not sure how I count the slashes.