pass value from embedded function into conditional of page the embedded function is included on
- by Brad
I have a page that includes/embeds a file that contains a number of functions.
One of the functions has a variable I want to pass back onto the page that the file is embedded on.
<?php
include('functions.php');
userInGroup();
if($user_in_group) {
print 'user is in group';
} else {
print 'user is not in group';
}
?>
function within functions.php
<?php
function userInGroup() {
foreach($group_access as $i => $group) {
if($group_session == $group) {
$user_in_group = TRUE;
break;
} else {
$user_in_group == FALSE;
}
}
}?>
I am unsure as to how I can pass the value from the function userInGroup back to the page it runs the conditional if($user_in_group) on
Any help is appreciated.