PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
now i know this is a long way of doing it.. i am going to have a lot of if and else statments in my menu once i have finished...i should using SWITCH statments but i wanna get this working first i guess.
$someVariable = 'Hello World!';
//this will output nothing since fooBar() does not have access to the pages scope
function fooBar() {
echo $someVariable;
}
//this will output Hello World! since we have passed $someVariable as an argument
function fooBar($someVariable) {
echo $someVariable;
}
//this will output Hello World! since you have made the variable scope global for that particular variable
function fooBar() {
global $someVariable;
echo $someVariable;
}