Closures

However, you can do this:

<?php
function getMsgFnc2() {
    global $msg;
    return function() use (&$msg) {
        echo "Msg: {$msg}!<br/>\n";
    };
}

$GLOBALS['msg'] = "Hello";
$fnc = getMsgFnc2();
$fnc();
$GLOBALS['msg'] = "World";
$fnc();
Output
Msg: Hello!
Msg: World!