0

Hello,

I have a function which is registering a navigation menu

function register_menu($name, $displayname){
	if(!is_menu()){
		
		$menu['name'] = $name;
		$menu['displayname'] = $displayname;
		$registered = TRUE; //This should be global, so that is_menu() function can use it.
	}
}

And another function which checks if the menu is registered

function is_menu(){
	return $registered; //I need to get this from register_menu(). How ?
}

How can I use variables from one function in another function ?

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Martin C++
1

Set global both sides:

function a()
{
        global $b;
        echo $b;
}

function c()
{
        global $b;
        $b = 'hello world';
        return $b;
}

c();
echo a();
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.