Skip to content

Instantly share code, notes, and snippets.

@kjbrum
Last active December 10, 2015 01:08
Show Gist options
  • Save kjbrum/b094db5c401325ddde43 to your computer and use it in GitHub Desktop.
Save kjbrum/b094db5c401325ddde43 to your computer and use it in GitHub Desktop.
Match the current URL against the supplied URL.
<?php
/**
* Match the current URL against the supplied URL.
*
* @param string $url The URL to be checked
* @return boolean
*/
function current_page_url_in( $url ) {
return ( strpos( $_SERVER['REQUEST_URI'], parse_url( $url, PHP_URL_PATH ) ) !== false );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment