Static variables retain their data even after the function gets done running. Then the next time you call it, it remembers the data it had from before because it is retained and persistent for the life of the web page request. Statics offer you an option instead of using global variables. Let’s take a look at how you can pass memory around in procedural coding without using globals.
In this video, you will write code to show how the static and non-static variable work. You’ll build a
for loop and then call two separate functions.
Code. Eat. Code. Sleep. Dream about Code. Code.
Total Lab Runtime: 01:50:52
- 1 PHP Variables Introductionfree 03:44
- 2 PHP Variables Intent and Namingfree 12:43
- 3 Variable Scopebasic 08:24
- 4 Function Parametersbasic 08:46
- 5 Variable - PHP Internalspro 11:08
- 6 Global Variablesbasic 09:10
- 7 Global Variables - PHP Internalspro 02:52
- 8 Static Variablesbasic 13:05
- 9 Static Variables - PHP Internalspro 05:01
- 10 Passing Variables By Referencepro 10:04
- 11 Passing Variables By Reference - PHP Internalspro 08:01
- 12 Namespacingbasic 01:37
- 13 Variable Scope When Including Filesbasic 08:24
- 14 Type Jugglingbasic 07:53