Search code examples
phpurlstring-search

How to check for certain values in url


Is it possible to check if the url contains certain values, for instance if the URL "www.example.com/dummy1/dummy2/dummy3/en/dummy4/tim/" has an "en" or not.


Thanks


Solution

  • if (in_array('en', explode('/', $url))) { 
        ...
    }