function getVarName(){
// https://github.com/gaffling/PHP-Get-Variable-Name-as-a-String/blob/master/function.php
// echo get_var_name($FooBar).' - '.$FooBar;
// read backtrace
$bt = debug_backtrace();
// read file
$file = file($bt[0]['file']);
// select exact print_var_name($varname) line
$src = $file[$bt[0]['line']-1];
// search pattern
$pat = '#(.*)'.__FUNCTION__.' *?\( *?(.*) *?\)(.*)#i';
// extract $varname from match no 2
$var = preg_replace($pat, '$2', $src);
// return the var name
return trim($var);
}
function debugServer($input, $input_name = "")
{
$temp = print_r($input, true);
error_log( $input_name . " : " . $temp);
}