Cariables set inside function are not being returned to parent
-
I’m probably doing something very stupid here but I can’t figure out what.
I have a page with a number of PHP functions in
when I set a $wp_session variable in a function, it doesn’t appear to be being returned to the parent
here’s a very simplified version of what is happening
$wp_session = WP_Session::get_instance();
callfunction ();
function callfunction ()
{
$wp_session = WP_Session::get_instance();
$wp_session = [‘test’] = ‘test’;— then we display a form with a submit button, this calls the same page
}when I print_r $wp_session after setting ‘test’, test shows. However, when I do the same on re-entering the page it doesn’t
been bugging me for a couple of days now ??
- The topic ‘Cariables set inside function are not being returned to parent’ is closed to new replies.