Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP global variables

Tags:

php

Why does the following result in an error message? (it is declared inside a function in PHP by the way; $a and $b are alphabetic values, not numeric)

global $pre[''.$a.''], $predis[''.$b.''];

Parse error: syntax error, unexpected '[', expecting ',' or ';' in ...
like image 560
Adam Strudwick Avatar asked Jun 26 '26 06:06

Adam Strudwick


1 Answers

global $pre, $predis;

Then use $pre and $predis how you want.

like image 79
GWW Avatar answered Jun 28 '26 19:06

GWW



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!