Scope refers to the visibility of a variable in the PHP script. A variable defined inside a function will have local scope i.e., within the function. A variable outside the function can have the same name as a local variable in a function, where the local variable has higher precedence over the outer variable. In some cases, a function might need access to a variable declared outside the function definition. In such cases, global declaration can be used before the variable name which allows the accessibility of the variable that is declared outside the function definition. Below example demonstrates local
The post How the variable scope works in PHP appeared first on Coding Security.
How the variable scope works in PHP
read more
Tidak ada komentar:
Posting Komentar