src/Util/U.php
public static function get_request_document() {
        $uri = $_SERVER['REQUEST_URI'];     // /tsugi/lti/some/cool/stuff
        $pieces = explode('/',$uri);
        if ( count($pieces) > 1 ) {
            $local_path = $pieces[count($pieces)-1];
            $pos = strpos($local_path,'?');
            if ( $pos > 0 ) $local_path = substr($local_path,0,$pos);
            return $local_path;
        }
        return false;
    }
public static function get_request_document() {
        $uri = $_SERVER['REQUEST_URI'];     // /tsugi/lti/some/cool/stuff
        $pieces = explode('/',$uri);
        if ( count($pieces) > 1 ) {
            $local_path = $pieces[count($pieces)-1];
            $pos = strpos($local_path,'?');
            if ( $pos > 0 ) $local_path = substr($local_path,0,$pos);
            return $local_path;
        }
        return false;
    }
public static function get_request_document ( ) { $ uri = $ _SERVER [ 'REQUEST_URI' ] ; // /tsugi/lti/some/cool/stuff $ pieces = explode ( '/' , $ uri ) ; if ( count ( $ pieces ) > 1 ) { $ local_path = $ pieces [ count ( $ pieces ) - 1 ] ; $ pos = strpos ( $ local_path , '?' ) ; if ( $ pos > 0 ) $ local_path = substr ( $ local_path , 0 , $ pos ) ; return $ local_path ; } return false ; }
Get the last bit of the path

input: /py4e/lessons/intro?x=2
output: intro
Get the last bit of the path