
April 20th, 2003, 08:05 PM
|
|
Junior Member
|
|
Join Date: Apr 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Quote:
function helloWorld($yourWords="GoodBye") {
echo $yourWords;
return $returnValue;
} |
What's $returnValue ? Nothing?
Quote:
$globalVariableHello = "Hello World";
$globalVariableGoodBye = "Good Bye"
function helloWorld() {
global $globalVariableHello; //global declaration
echo $globalVariableHello; // access global variable
echo $GLOBALS["globalVariableGoodBye"]; // access $GLOBALS array
} |
missing semi-colon after $globalVariableGoodBye = "Good Bye". Also, global declarationof Hello is fine, but definition of GoodBye also must exist inside of the function.
Quote:
// Notice in this example only one parameter for user information called $userInfo, this is // because this variable is an array |
the second // must be on its own line, or must be before "called"
Quote:
$theVar = "hello world"
$theVar = "good bye" |
missing semicolon in both places, in both examples
Other than those few typos.. awesome article. The dynamic functions are nice and work the same way as dynamic variables
$name = "foo";
$$name = "bar";
echo $foo;
// output: bar
|