I've not that new to php but am trying to figure out how exactly this piece of code reads.
$actions = array();
function add_action( $hook, $function )
{
global $actions;
// create an array of function handlers if it doesn't already exist
if( !isset( $actions[ $hook ] ) )
$actions[ $hook ] = array();
// append the current function to the list of function handlers
$actions[ $hook ][] = $function;
}
here is my understanding but I believe I'm completely wrong - variable actions is given an array with no params, then a function is created and actions is made into a global giving it global scope. Then there a condition the bit I don't understand that somehow checks for a parem. $actions[ $hook ]
its what this bit means that confuses me. is it calling into the array? and why are blank arrays set to variables?
Thanks for clearing this up for me