Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

How to declare a local & global variable in PHP?

Local Variable:-

Local Variables mean local is declared inside a function. Its value applies in any function. When local variable value modified in one function then changes not apply in other function changes apply in particular function.

PHP- Global Variable:-

Global Variable means that Global that declared from outside of the function. It is created before the function’s execution starts and lost when the function switch. When you want to access global function in function then add global in function then access global from inside a function.

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)