In order to be proficient in PHP, you need to first know variables. It’s learn and do time. In this lab, you are focusing on user-defined variables, the data they represent, how they are passed and assigned into function parameters’ list, naming, and their scope. For Pro members, you learn more about the PHP internals, how variables are linked to their data, and how memory moves around under the hood.
What You Will Learn
This lab will teach you deeply about PHP variables. You learn:
- What variables are and why we use them
- Scope – who can access them and where
- Passing data around in code as you call functions
- Deep technical look into how data moves around and is tracked by PHP
- PHP interpreter’s source code
- Global and static variables
- Passing by value verses by reference
- Type juggling – how PHP changes the data type
- and much more
The lab is broken up into a general discussion with the basic labs. Then for the pro labs, we get geeky and technical. You are going to learn how data moves around as you pass it to and from functions and methods. It will help you to understand all the different use cases and techniques for working with data in your code.
You will be writing code in this lab. You’ll need to have a basic local web development set up and ready to go. You can refer to this article in the Help Center to set up your local sandbox test website.
In addition, I’m using a bare-bones PHP-only setup. If you are using DesktopServer, then you can select to create a new website and then the “Blank (non-WordPress)” blueprint. There’s no need to run WordPress with this lab.
If you are new to programming or PHP, then I highly recommend that you do this lab first.
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
Welcome to WordPress programming. In this hands-on code building lab, you are going to get a gentle introduction into PHP programming. This lab assumes that you do not know anything about programming or PHP. You'll start at the beginning and incrementally learn the major concepts and instructions you'll encounter. It's PHP 101.
Check out the PHP Library for more hands-on labs, insights, Docx, and more.