How to find URL Path via php?

$url = $_SERVER[“SERVER_NAME”].”:”.$_SERVER[“SERVER_PORT”].$_SERVER[“REQUEST_URI”];
$URLpath = parse_url($url, PHP_URL_PATH);
$catPathAraay = explode(“-“, $URLpath);
$catPath = $catPathAraay[2];
//echo $catPath;

the above code find particular url path.

© 2020 Spirituality