while loops in php||php do while tutorial in hindi/urdu||php break and continue statement tutorial
#PGTCOMPUTER #phploop #while #dowhile #fibonoic
#navodaya2020
#computerteacher
#kvscomputerteacher
#rajsthanpatwari
#rajsthanconstable
#bank_PO
#ssc_exam
#ibps
#राजस्थानपटवारीपरीक्षा
#राजस्थानकॉन्स्टेबलभर्तीपरीक्षा
#computerteachervacancy2020
What is email
WHAT IS protocol
How to USE email protocol
#computer
#information technology
#RKCL
#CBSE
#RBSE
#phptutorial #website # beginners #php #hindi # hanumankhatore #phpproject #phpfullcourse
Hanuman khator channel को subscribe करना ना भूले।
इतने प्रकार के telnet protocol नही देखे होंगे|| types of telnet protocol in hindi||
WHATSAPP NO 9828128420 FOR FREE COUNSELING IN sriganganagar
Computer classes| most 5 questions|| BCA||BTech||MSc||MCA
New update 2020
PGT COMPUTER TEACHER
Telnet protocol in hindi||Telnet protocol in computer network ||what is telnet ||easily explained
Operating system is linux
Computer teacher vacancy in rajasthan 2020
Rajasthan patwari bharti 2020
What is computer
How to subscribe
1. Youtube को open करो।
2. Hanuman khator टाइप करो।
3.subscribe का बटन दबाए।
PHP - Loop Types
• while − loops through a block of code if and as long as a specified condition is true.
• do...while − loops through a block of code once, and then repeats the loop as long as a special condition is true.
The PHP while Loop
The while loop executes a block of code as long as the specified condition is true.
Syntax
while (condition is true) {
code to be executed
}
Examples
The example below displays the numbers from 1 to 5:
Example
?php
$x = 1
while($x = 5) {
echo "The number is: $x br"
$x++
}
?
Example Explained
• $x = 1 - Initialize the loop counter ($x), and set the start value to 1
• $x = 5 - Continue the loop as long as $x is less than or equal to 5
• $x++ - Increase the loop counter value by 1 for each iteration
When to use while loops
• While loops are used to execute a block of code until a certain condition becomes true.
• You can use a while loop to read records returned from a database query.
Types of while loops
• Do… while - executes the block of code at least once before evaluating the condition
• While… - checks the condition first. If it evaluates to true, the block of code is executed as long as the condition is true. If it evaluates to false, the execution of the while loop is terminated.
PHP Do While
The difference between While… loop and Do… while loop is do… while is executed at-least once before the condition is evaluated.
Let’s now look at the basic syntax of a do… while loop
?php
do{
block of code to be executed
}
?
while(condition)
HERE,
• “do{…} while(…)” is the do… while loop block code
• “condition” is the condition to be evaluated by the while loop
• “block of code…” is the code that is executed at least once by the do… while loop
How it works
The flow chart shown below illustrates how the while… loop works
Practical example
We are now going to modify the while… loop example and implement it using the do… while loop and set the counter initial value to 9.
The code below implements the above modified example
?php
$i = 9
do{
echo "$i is"." br"
}
while($i 9)
?
The above code outputs:
9
The break statement
The PHP break keyword is used to terminate the execution of a loop prematurely.
The break statement is situated inside the statement block. It gives you full control and whenever you want to exit from the loop you can come out. After coming out of a loop immediate statement to the loop will be executed.
Example
In the following example condition test becomes true when the counter value reaches 3 and loop terminates.
Live Demo
html
body
?php
$i = 0
while( $i 10) {
$i++
if( $i == 3 )break
}
echo ("Loop stopped at i = $i" )
?
/body
/html
This will produce the following result −
Loop stopped at i = 3
The continue statement
The PHP continue keyword is used to halt the current iteration of a loop but it does not terminate the loop.
Just like the break statement the continue statement is situated inside the statement block containing the code that the loop executes, preceded by a conditional test. For the pass encountering continue statement, rest of the loop code is skipped and next pass starts.
Example
In the following example loop prints the value of array but for which condition becomes true it just skip the code and next value is printed.
Live Demo
html
body
?php
$array = array( 1, 2, 3, 4, 5)
foreach( $array as $value ) {
if( $value == 3 )continue
echo "Value is $value br /"
}
?
/body
/html
This will produce the following result −
Value is 1
Value is 2
Value is 4
Value is 5
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «while loops in php||php do while tutorial in hindi/urdu||php break and continue statement tutorial», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.