Можно ли использовать константу PHP внутри функции PHP?
// in a different file
DEFINE ('HOST', 'hostname');
DEFINE ('USER', 'username');
DEFINE ('PASSWORD', 'password');
DEFINE ('NAME', 'dbname');
// connecting to database
function database()
{
// using 'global' to define what variables to allow
global $connection, HOST, USER, PASSWORD, NAME;
$connection = new mysqli(HOST, USER, PASSWORD, NAME)
or die ('Sorry, Cannot Connect');
return $connection;
}