php claims my defined variable is undefined

后端 未结 4 1962
北海茫月
北海茫月 2020-12-19 03:27

My php is a little rusty but this is boggling my mind right now. I googled this and read all the stackoverflow questions I could find that looked related, but those all seem

4条回答
  •  执念已碎
    2020-12-19 03:52

    $msg
    "; } function print_msgs(){ global $msgs; print $msgs; } add_msg("test"); add_msg("test2"); print_msgs(); ?>

    global tells that PHP need to use the global variable in the local function scope.

提交回复
热议问题