课程: PHP for WordPress (2020)

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

What are variables?

What are variables?

- [Instructor] Printing information onto the screen is great but we don't always know exactly what information we'll need when we're writing our code. For example, if we want to print the visitor's name, there's no possible way of knowing that information before they visit. That's where variables come in. Variables are a way to store information in order to reference it later. Variables could be used to store names, numbers, and other important data. All PHP programs, including Wordpress, heavily use variables. All variables must start with a dollar sign followed by an alpha-numeric character string. Here's an example. We have the variable age written as $age, an equal sign, the number 34 and a semicolon. Age is a placeholder that we're using to store the number 34. PHP knows age is 34 because of the equal sign, which means is assigned or gets. I'll usually say gets when referring to variable assignments. We can…

内容