I had a little issue, i need to extract a string from the URL that looks like this:
http://www.myserver.com/category/firstcat/second-cat/
All my URLs has this structure, and I need to catch the “firstcat” string
I would appreciate your help!
Thanks so much!
If you’re trying to do this on the current url the user is on, you’ll need
$_SERVER['REQUEST_URI']. That will show you the current uri open, in this case/category/firstcat/second-cat/.Then use anything you prefer to parse the string and get to the element you want, for example: