We break up our code into logical parts in order to organize our code. In PHP we do this by files, folders, and functions. It lets us organize and structure our code. Why?
Imagine all of the code in WordPress in one huge file. It would have tens of thousands of lines of code. Imagine trying to work on that one huge file. It would be very difficult and prone to errors. It’s also hard to build code in teams.
We break up code to improve:
Imagine that 3 months from now your customer calls you with a problem. If all of the code were listed in a file with 100,000 lines of code and no functions to break it up, imagine how long it would take you to find the problem and resolve it. Yuck!
Breaking up reduces our costs and the time to build and maintain code. Let’s talk about it.
Don’t repeat yourself. Don’t repeat yourself. Don’t repeat yourself.
Total Lab Runtime: 03:21:32
- 1 Lab Introductionfree 11:37
- 2 What is PHP? Why use it?free 17:49
- 3 Why and how does WordPress use PHP?free 07:33
- 4 Syntax Basicsfree 18:34
- 5 What's the deal with Variables?free 27:05
- 6 Break Up Code into Logical Partsfree 07:55
- 7 Subroutines - Behold the functionfree 14:11
- 8 Loading Files to Runfree 13:20
- 9 To Run or Not to Run - Making Decisionsfree 19:07
- 10 Sequencing - Yup, code runs in orderfree 06:16
- 11 Repeating code using Loopsfree 13:57
- 12 Building Strings with Dots and Variablesfree 15:10
- 13 What's the deal with scope?free 08:34
- 14 Naming Stufffree 06:18
- 15 Putting it All Togetherfree 08:33
- 16 Where do I go from here?free 05:33