I need to create a an if statement that fires if there is something after a given string in the URL.
For example, if my string is 'Honda' I need to check if something appears after that word in the url, eg something like:
$brand = "honda";
if (url contains $brand . '/*'){
// Do something.
}
Example urls could be:
- mysite.com/honda (which would fail the above)
- mysite.com/cars/honda (which would fail the above)
- mysite.com/honda/civic (which would pass the above)
- mysite.com/honda/accord (which would pass the above)
I know I can use strpos()
to detect if the string is within the URL, but how can I detect if anything comes after that?