RUVIDEO
Поделитесь видео 🙏

PHP Arrays | Tutorial

📁 Обучение 👁️ 16 📅 30.11.2023

Course Title: Web Development Masterclass
Course Link: http://youaccel.com/admin/cdisplay.php?cid=11

Facebook: https://www.facebook.com/youaccel
Twitter: https://twitter.com/YouAccel
Website: http://youaccel.com

Tutorial Content:

In this lecture we will explore PHP Arrays. We have already had a bit of exposure to arrays in some of the previous lessons.

An array is a variable that can store multiple values.

In PHP there are three types of arrays:

Indexed arrays
Associative arrays
Multidimensional arrays
We will start with an example of an indexed array.

Here, we have a variable named colors. The variable contains three values, blue, green, and red.

We can output each value in the array by specifying its unique index number in square brackets, next to the array variable name. An index always starts with the number 0. The 0 is assigned to the first value in the array. So in this case, blue would have the index number 0. The index increments by 1, so the value green would have index number 1, and red would have index number 2.

We can use the count() function to return the length, or number of values in an array. In this case we have three values.

By typing count(Colors) we can see the number 3 outputted in our web browser.

We can loop through the values of an indexed array using the for loop.

First we specify we want the value of x to start at 0 and increment by 1, upto the length of the array.
The length is obtained using our count function and storing the value in variable arrlength.

Next we simply loop through each index number in our array, which will output the value attached to the index number.

The next type of array we want to explore is the Associative Array.

This type of an array allows us to assign values to our elements, referred to as named keys.

In this example, we have created an associate array variable named tscore. For the purpose of this example, we will assume tscore holds the mark that students scored on a test out of 100.
tscore, has three elements, John, Bill and Dan. Each element has a name key, or value assigned to it.
John is assigned the value 60, Bill - 80 and Dan - 75.

Next we use our echo statement to output the the mark that Bill got on the test.
We do that using our echo statement, and inserting the named key in square brackets next to the associative array name.

We can loop through an associative array using the foreach loop. In our browser we can see the output.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «PHP Arrays | Tutorial», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.