Helpers.php

Global helper functions for the weatherstation app

Functions

get_var()

get_var(string  $name) : mixed

search global request variables $_POST and $_GET in that order and return the first defined value for the given key

Parameters

string $name

Returns

mixed —

the value of the variable name (if any) or null.

site_url()

site_url() : string

return the full URL for the base page of the site.

Returns

string

prettyprint()

prettyprint(string  $string) : string

wrap html pre tags around the given string, with class="prettyprint"

Parameters

string $string

Returns

string —

Formatted html

check_mysql_error()

check_mysql_error(\MySQLi_Result  $result, \MySQLi  $mysqli) 

die with the error message if the given result handle or mysqli object has an error

Parameters

\MySQLi_Result $result
\MySQLi $mysqli

flatten_array()

flatten_array(array  $array) : array

Flatten a multiple dim array into a single list

Parameters

array $array

Returns

array

dec2hex()

dec2hex(  $str) 

Parameters

$str

trim_left_zeros()

trim_left_zeros(  $str) 

Parameters

$str