Photo by Émile Perron on Unsplash

Function Reference


_r ( array $array, str $descriptor = '' )

Alias for print_r with nice formatting

Source

DEFINE ( 'PRE', '<pre>' ) ;
DEFINE ( 'NPRE', '</pre>' ) 

function _r ( $array, $descriptor = '' ) {
    if ( $descriptor != '' ) echo '<h5 class="rh5">' . strtoupper($descriptor) . '</h5>' ;
    echo PRE ;
    print_r ( $array ) ;
    echo NPRE ;
}

get_protocol()

checking if protocol is HTTP or HTTPS

Return

String

Source

function get_protocol() {
    if ( isset ( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] != 'off' ) {
    // this is HTTPS
        $protocol = "https";
    } else {
    // this is HTTP
        $protocol = "http";
    }
    return $protocol ;
}

route()

Route of URL, without GET Prameters

Return

String

Source

function route() {
    $route = $_SERVER["REQUEST_URI"] ;
    $pos = strpos ( $route, '?' ) ;
    if (!( $pos === false )) {
        $route = substr ( $route, 0, $pos ) ;
    }
    return $route ;
};

TITLE: Function Reference
DATE: 2017-12-08
AUTHOR: jRu
SOURCE:
TAGS:
function manual reference