$url = $_SERVER['REQUEST_URI'];preg_match('/\/.*\/([0-9]+)\-.*/', $url, $matches);if (count($matches) > 1) { echo 'Userid: ' . $matches[1]; }