Question: what is global and local variable in php?
Answer: Local variables: The variables declared within a function are called local variables to that function and has its scope only in that particular function. In simple words it cannot be accessed outside that function. ... Global variables: The variables declared outside a function are called global variables.