Is $hook a global variable in WordPress

Ok – so, firstly you should know that it is a variable and not a function – in php this is indicated by the dollar symbol before the name: $variable as opposed to function()

Second, you should note that $hook is passed as a parameter to the function block – like so:

function_name( $hook ){

    // this makes the variable $hook available inside the function - not globally.
    echo $hook;

}

So, $hook is actually passed to the function from the “hook” admin_enqueue_scripts which you can read on the codex page describes the value as $hook as:

Parameters

$hook_suffix
(string) The current admin page.

So, the answer is that $hook is not a global variable, nor a function ( essentially all WordPress functions are global, but that is another point ) – it is a local variable passed into the scope of the function hooked to the action.