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