今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Using arrays
- [Instructor] Arrays are a bit different from the rest of our variables. Arrays act as key-value pairs that essentially function as a set of variables. So let's say we want a collection of colors like we have on the screen here. We could store each color in a variable where color1 gets red, color2 gets green, et cetera but that can get cumbersome and hard to manage and depending on the size of the data, inefficient for PHP to run. So instead, we would use an array. We can create a single variable called colors and then use the array keyword. When we add an array, we would use the keyword array and then an opening parentheses. Then we would add each color in a comma-separated list. So we would write single quote red and single quote comma green comma blue comma yellow. And then the closing parentheses and the semicolon. Now, we can reference each element in the array based on an index. But to better…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
What is PHP?2 分钟 1 秒
-
(已锁定)
Printing information3 分钟 15 秒
-
(已锁定)
What are variables?6 分钟
-
(已锁定)
Strings in PHP5 分钟 57 秒
-
(已锁定)
Using arrays7 分钟 59 秒
-
(已锁定)
Arithmetic operators and math in PHP4 分钟 38 秒
-
(已锁定)
Challenge: Perform a mathematic operation and store it1 分钟 14 秒
-
(已锁定)
Solution: Perform a mathematic operation and store it3 分钟 33 秒
-
-
-
-
-