- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Understanding PHP for Loops in Under a Minute
Loop means repetition or iteration. When a task needs to execute more than once then we call it loop. This code block then wraps with loop and one of such loop formation is called for loop.
Here is how a for loop is written. We are using keyword "for" to create the for loop, followed by parentheses. All the three parts of for loop goes into these parentheses.
for (initialize; condition; increment/decrement)
{
statement 1;
statement 2;
.....
.....
statement N;
}
Let's see an example.
Step 1. Initialization - variable initialize with a value. This part execute at first and only once.
Step 2. Condition - check whether value is less than or equal to 10. This part executes after each increment or decrement.
Step 3. Increment or decrement - increase value by 1. This part executes after each iteration.
Once the condition fails, means value is more than 10, then for loop stops and next line after the loop will execute.
for ($i = 1; $i == 10; $i++) {
echo $i;
}
Видео Understanding PHP for Loops in Under a Minute канала PHP Explained
Here is how a for loop is written. We are using keyword "for" to create the for loop, followed by parentheses. All the three parts of for loop goes into these parentheses.
for (initialize; condition; increment/decrement)
{
statement 1;
statement 2;
.....
.....
statement N;
}
Let's see an example.
Step 1. Initialization - variable initialize with a value. This part execute at first and only once.
Step 2. Condition - check whether value is less than or equal to 10. This part executes after each increment or decrement.
Step 3. Increment or decrement - increase value by 1. This part executes after each iteration.
Once the condition fails, means value is more than 10, then for loop stops and next line after the loop will execute.
for ($i = 1; $i == 10; $i++) {
echo $i;
}
Видео Understanding PHP for Loops in Under a Minute канала PHP Explained
Комментарии отсутствуют
Информация о видео
17 марта 2025 г. 10:23:47
00:00:57
Другие видео канала





















