<?php
$test = 'this is just a test';
// This echo works
echo $test;
function example_test()
{
global $test;
// This echo does not work:
echo $test;
}
example_test();
?>
I cant find my mistake.
Why does the echo in that function not work?
The PHP is includedfromwithin a s9y PHP function. Thus you need to insert a "global $test" also at the very first line of your PHP code as well, not only within your function declaration.
Or you directly use $GLOBALS['test'] instead of $test everywhere.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/