If we want to use global variable ina a function, is there any way? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If we want to use global variable ina a function, is there any way?

9th Aug 2016, 9:17 AM
Veeshel Khundrakpam
Veeshel Khundrakpam - avatar
1 Answer
0
use global key word inside function. like $var1 = 'my var'; function glbvar(){ global $var1; echo $var1; }
10th Aug 2016, 3:32 PM
king