[TYPO3-german] global variable in function

Holger Hellmuth holger at gspranz.de
Wed Feb 28 03:19:15 CET 2007


a owen wrote:
> Hi,
> 
> I having troubles with "global" in my own php-functions. somehow my
> functions cant see outside variables even if i set them as global.
> 
> $i = 5;
> 
> function test() {
> 	global $i;
> 	echo $i;
> }
> 
> There is no output, what can i do. i've checked google and php.net, but

Well, you defined the function test, but you don't call it. If you add
test();

you get '5' as output.



More information about the TYPO3-german mailing list