Small silly mistake i did and. I hope u won't repeat it. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Small silly mistake i did and. I hope u won't repeat it.

hello guys. here is a small yet big mistake which i did and took me long to realise. i defined a variable in a file and used it in another file which i included in it. say i included include.php inside index.php. then i defined a variable in index.php and tried to use it in include.php, it won't work unless we declare it global i searched my code many a times for error spending hours, as i forgot to declare it global. i hope this may help someone avoid the mistake i did in my code. Have a nice day

7th Jan 2017, 11:31 AM
Vishal Jaiswal
1 Answer
+ 1
Thanks for sharing.
7th Jan 2017, 6:37 PM
Ravindra Sisodia
Ravindra Sisodia - avatar