A variable declared static outside of a function has a scope the of the source file only. It is not a global variable. A variable declared outside of a function and without the static qualifier would be a global variable.
No reason. They don't have.
'global static'?! There is no such thing.
The program's data segment. This area of memory is allocated by the linker and is used to store the program's global variables, static variables, static arrays and constants. Constants are always initialised, as are static variables, but global variables and static arrays need not be initialised.
Only global/static variables are, local variables aren't.
Static variables or function provides global view to the application that is u can access a static variable with one or more than one objects of a single class without loosing i.e. reinitializing its value.
For global/static variables: yes.For auto variables: no.
A static variable is a variable allocated in static storage. A local variable is a variable declared inside a function. A global variable is a variable declared outside of any class or function. Note that local variables and global variables can both be allocated in static storage.
Scope of static variable is with in the file if it is static global. Scope of static variable is with in the function if variable is declared local to a function. But the life time is throughout the program
'global static'?! There is no such thing.
The program's data segment. This area of memory is allocated by the linker and is used to store the program's global variables, static variables, static arrays and constants. Constants are always initialised, as are static variables, but global variables and static arrays need not be initialised.
Only global/static variables are, local variables aren't.
Static may be local of global -local static variable is limited to the function scope. and retain it's value when function is been called . compiler differentiate static variables with a prefix function name while dealing with same name static variable in different functions. - Global static variable is visible to all the function defined in the file and retain it value but it cannot be used outside this file. now Global Variable --- this variable is also visible to all of the functions inside the file but also can be used outside the file via extern keyword.
Static functions are tied to a class, not to a particular object. A static function can only access static variables because it has no knowledge of member variables.
Static variables or function provides global view to the application that is u can access a static variable with one or more than one objects of a single class without loosing i.e. reinitializing its value.
For global/static variables: yes.For auto variables: no.
Use the "static" keyword to declare a static variable within a function like shown below. <?php function fun() { static $variable; static $another_variable = ''; } ?>
The ones that are declared outside any functions and don't have modifier static.
Local variables: These variables only exist inside the specific function that creates them. They are unknown to other functions and to the main program. As such, they are normally implemented using a stack. Local variables cease to exist once the function that created them is completed. They are recreated each time a function is executed or called. Global variables: These variables can be accessed (ie known) by any function comprising the program. They are implemented by associating memory locations with variable names. They do not get recreated if the function is recalled.