$value){ $vars[] = "$".$key; } return "global " . join(",", $vars) . ";"; } function utf8entities($utf8) { // Credits to silverbeat@gmx.at (http://www.php.net/manual/en/function.htmlentities.php#96648) $encodeTags = true; $result = ''; for ($i = 0; $i < strlen($utf8); $i++) { $char = $utf8[$i]; $ascii = ord($char); if ($ascii < 128) { $result .= ($encodeTags) ? htmlentities($char) : $char; } else if ($ascii < 192) { // Do nothing. } else if ($ascii < 224) { $result .= htmlentities(substr($utf8, $i, 2), ENT_QUOTES, 'UTF-8'); $i++; } else if ($ascii < 240) { $ascii1 = ord($utf8[$i+1]); $ascii2 = ord($utf8[$i+2]); $unicode = (15 & $ascii) * 4096 + (63 & $ascii1) * 64 + (63 & $ascii2); $result .= "&#$unicode;"; $i += 2; } else if ($ascii < 248) { $ascii1 = ord($utf8[$i+1]); $ascii2 = ord($utf8[$i+2]); $ascii3 = ord($utf8[$i+3]); $unicode = (15 & $ascii) * 262144 + (63 & $ascii1) * 4096 + (63 & $ascii2) * 64 + (63 & $ascii3); $result .= "&#$unicode;"; $i += 3; } } return $result; } function clean_array($arr) { $result = array(); foreach($arr as $key => $value) { if(!empty($value)) { $result[$key] = $value; } } return $result; } function pretty_dump($input) { ob_start(); var_dump($input); $output = ob_get_contents(); ob_end_clean(); while(preg_match("/^[ ]*[ ]/m", $output) == 1) { $output = preg_replace("/^([ ]*)[ ]/m", "$1   ", $output); } $output = nl2br($output); echo($output); } /*function is_empty($variable) { return (trim($variable) == ""); }*/