SlideShare une entreprise Scribd logo
1  sur  22
LOOPING STATEMENT IN PHP 1 www.YouStudy.IN
Looping statement Loops execute a block of code a specified number of times, or while a specified condition is true. In PHP, the following looping statements are used: The While Loop  The Do...While Loop  The For Loop  The Foreach Loop  Break and Continue Statements  2 www.YouStudy.IN
The while loop While structure is another type of loop statements, where the condition is checked at first, the iteration will not stop even if the value changes while executing statements. 3 www.YouStudy.IN
Syntax   while (condition) {  code to be executed;} 4 www.YouStudy.IN
Example  <?php$i=0;while ($i <= 10) { // Output values from 0 to 10   echo "The number is ".$i."<br />";   $i++;}?> 5 www.YouStudy.IN
The do while loop Do While statement is same as the while statement, the only difference is that it evaluates the expression at the end. 6 www.YouStudy.IN
Syntax  do {   code to be exected;}while (condition); 7 www.YouStudy.IN
Example  <?php $i = 0;do {   echo "The number is ".$i."<br/>";   $i++;} while ($i <= 10);?> 8 www.YouStudy.IN
The For Loop The for loop is used when you know in advance how many times the script should run. 9 www.YouStudy.IN
Syntax  for (initialization; condition; increment) {   code to be executed;} 10 www.YouStudy.IN
For loop cont.. he For statement takes three expressions inside its parentheses, separated by semi-colons. When the For loop executes, the following occurs: The initializing expression is executed. This expression usually initializes one or more loop counters, but the syntax allows an expression of any degree of complexity.  The condition expression is evaluated. If the value of condition is true, the loop statements execute. If the value of condition is false, the For loop terminates.  The update expression increment executes.  The statements execute, and control returns to step 2. 11 www.YouStudy.IN
Example  <?phpfor ($i=0; $i <= 10; $i++) {   echo "The number is ".$i."<br />";}?> 12 www.YouStudy.IN
The Foreach Loop For Each structure is a loop structure used for arrays 13 www.YouStudy.IN
Syntax  foreach (array as value){   code to be executed;}    foreach (array as key => value){   code to be executed;} 14 www.YouStudy.IN
Example  <?php$email = array('john.smith@example.com', 'alex@example.com');foreach ($email as $value) {   echo "Processing ".$value."<br />";}?> 15 www.YouStudy.IN
The break statement Break ends the execution of the for, for each, while, do-while or switch statement. 16 www.YouStudy.IN
Syntax  Break (Optional numeric argument)  17 www.YouStudy.IN
Example  <?php  $c = 0;  while (++$c)  {  switch ($c)  {  case 5:  echo "At 5;"; break 1;  case 10: echo "At 10; quitting"; break 2; default:  break;  } } ?>  18 www.YouStudy.IN
The continue statement "Continue" is used to skip the current loop iteration and continue with the next iteration of the loop. But "Break" is used to exit from the whole loop. 19 www.YouStudy.IN
Syntax  Continue (Optional numeric argument);  20 www.YouStudy.IN
Example  <?php for ($c = 0; $c <=10; ++$c)  { if ($c == 5)  { continue; } print "$c ";  }  ?>  21 www.YouStudy.IN
The End THANK U 22 www.YouStudy.IN

Contenu connexe

Tendances (20)

Function in C program
Function in C programFunction in C program
Function in C program
 
Looping statements in C
Looping statements in CLooping statements in C
Looping statements in C
 
Conditional statement c++
Conditional statement c++Conditional statement c++
Conditional statement c++
 
Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
 
Java operators
Java operatorsJava operators
Java operators
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statement
 
Break and continue
Break and continueBreak and continue
Break and continue
 
Strings
StringsStrings
Strings
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
 
Loops and conditional statements
Loops and conditional statementsLoops and conditional statements
Loops and conditional statements
 
The Loops
The LoopsThe Loops
The Loops
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Pointers C programming
Pointers  C programmingPointers  C programming
Pointers C programming
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
 
JavaScript Data Types
JavaScript Data TypesJavaScript Data Types
JavaScript Data Types
 
Java Basics
Java BasicsJava Basics
Java Basics
 
C functions
C functionsC functions
C functions
 

En vedette

Looping and switch cases
Looping and switch casesLooping and switch cases
Looping and switch casesMeoRamos
 
Loops in C Programming
Loops in C ProgrammingLoops in C Programming
Loops in C ProgrammingHimanshu Negi
 
Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Ahmed El-Arabawy
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving toolsShay Cohen
 
Looping and Switchcase BDCR
Looping and Switchcase BDCRLooping and Switchcase BDCR
Looping and Switchcase BDCRberiver
 
Fundamentals of programming finals.ajang
Fundamentals of programming finals.ajangFundamentals of programming finals.ajang
Fundamentals of programming finals.ajangJaricka Angelyd Marquez
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming LanguageMahantesh Devoor
 
Chapter 05 looping
Chapter 05   loopingChapter 05   looping
Chapter 05 loopingDhani Ahmad
 
Switch case and looping statement
Switch case and looping statementSwitch case and looping statement
Switch case and looping statement_jenica
 
C Language - Switch and For Loop
C Language - Switch and For LoopC Language - Switch and For Loop
C Language - Switch and For LoopSukrit Gupta
 
Do...while loop structure
Do...while loop structureDo...while loop structure
Do...while loop structureJd Mercado
 
10. switch case
10. switch case10. switch case
10. switch caseWay2itech
 
Switch Case in C Programming
Switch Case in C ProgrammingSwitch Case in C Programming
Switch Case in C ProgrammingSonya Akter Rupa
 
Do While and While Loop
Do While and While LoopDo While and While Loop
Do While and While LoopHock Leng PUAH
 
While , For , Do-While Loop
While , For , Do-While LoopWhile , For , Do-While Loop
While , For , Do-While LoopAbhishek Choksi
 
Presentation on nesting of loops
Presentation on nesting of loopsPresentation on nesting of loops
Presentation on nesting of loopsbsdeol28
 

En vedette (20)

Looping and switch cases
Looping and switch casesLooping and switch cases
Looping and switch cases
 
Loops in C Programming
Loops in C ProgrammingLoops in C Programming
Loops in C Programming
 
Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
 
Looping and Switchcase BDCR
Looping and Switchcase BDCRLooping and Switchcase BDCR
Looping and Switchcase BDCR
 
Fundamentals of programming finals.ajang
Fundamentals of programming finals.ajangFundamentals of programming finals.ajang
Fundamentals of programming finals.ajang
 
Looping in C
Looping in CLooping in C
Looping in C
 
Looping
LoopingLooping
Looping
 
Loops in C Programming Language
Loops in C Programming LanguageLoops in C Programming Language
Loops in C Programming Language
 
Chapter 05 looping
Chapter 05   loopingChapter 05   looping
Chapter 05 looping
 
Switch case and looping statement
Switch case and looping statementSwitch case and looping statement
Switch case and looping statement
 
C Language - Switch and For Loop
C Language - Switch and For LoopC Language - Switch and For Loop
C Language - Switch and For Loop
 
Do...while loop structure
Do...while loop structureDo...while loop structure
Do...while loop structure
 
Loops in C
Loops in CLoops in C
Loops in C
 
10. switch case
10. switch case10. switch case
10. switch case
 
Switch Case in C Programming
Switch Case in C ProgrammingSwitch Case in C Programming
Switch Case in C Programming
 
Do While and While Loop
Do While and While LoopDo While and While Loop
Do While and While Loop
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and looping
 
While , For , Do-While Loop
While , For , Do-While LoopWhile , For , Do-While Loop
While , For , Do-While Loop
 
Presentation on nesting of loops
Presentation on nesting of loopsPresentation on nesting of loops
Presentation on nesting of loops
 

Similaire à Looping statement

What Is Php
What Is PhpWhat Is Php
What Is PhpAVC
 
Php Operators N Controllers
Php Operators N ControllersPhp Operators N Controllers
Php Operators N Controllersmussawir20
 
03loop conditional statements
03loop conditional statements03loop conditional statements
03loop conditional statementsAbdul Samad
 
CPAP.com Introduction To Coding: Part 2
CPAP.com Introduction To Coding: Part 2CPAP.com Introduction To Coding: Part 2
CPAP.com Introduction To Coding: Part 2johnnygoodman
 
Computer programming
Computer programmingComputer programming
Computer programmingXhyna Delfin
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and loopingChaAstillas
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and loopingaprilyyy
 
PHP MATERIAL
PHP MATERIALPHP MATERIAL
PHP MATERIALzatax
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping newaprilyyy
 
Php Loop
Php LoopPhp Loop
Php Looplotlot
 
Macasu, gerrell c.
Macasu, gerrell c.Macasu, gerrell c.
Macasu, gerrell c.gerrell
 
Switch case and looping kim
Switch case and looping kimSwitch case and looping kim
Switch case and looping kimkimberly_Bm10203
 
Fundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinaFundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinarurumedina
 

Similaire à Looping statement (20)

What Is Php
What Is PhpWhat Is Php
What Is Php
 
Php Operators N Controllers
Php Operators N ControllersPhp Operators N Controllers
Php Operators N Controllers
 
03loop conditional statements
03loop conditional statements03loop conditional statements
03loop conditional statements
 
CPAP.com Introduction To Coding: Part 2
CPAP.com Introduction To Coding: Part 2CPAP.com Introduction To Coding: Part 2
CPAP.com Introduction To Coding: Part 2
 
Computer programming
Computer programmingComputer programming
Computer programming
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and looping
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and looping
 
PHP MATERIAL
PHP MATERIALPHP MATERIAL
PHP MATERIAL
 
Switch case and looping new
Switch case and looping newSwitch case and looping new
Switch case and looping new
 
Switch case and looping jam
Switch case and looping jamSwitch case and looping jam
Switch case and looping jam
 
Janakiram web
Janakiram webJanakiram web
Janakiram web
 
Final requirement
Final requirementFinal requirement
Final requirement
 
Php Loop
Php LoopPhp Loop
Php Loop
 
Macasu, gerrell c.
Macasu, gerrell c.Macasu, gerrell c.
Macasu, gerrell c.
 
Switch case and looping kim
Switch case and looping kimSwitch case and looping kim
Switch case and looping kim
 
Flow of control ppt
Flow of control pptFlow of control ppt
Flow of control ppt
 
My final requirement
My final requirementMy final requirement
My final requirement
 
Fundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medinaFundamentals of prog. by rubferd medina
Fundamentals of prog. by rubferd medina
 
C++ programming
C++ programmingC++ programming
C++ programming
 
Lesson 6 php if...else...elseif statements
Lesson 6   php if...else...elseif statementsLesson 6   php if...else...elseif statements
Lesson 6 php if...else...elseif statements
 

Plus de ilakkiya

History object
History objectHistory object
History objectilakkiya
 
Twisted pair cable
Twisted pair cableTwisted pair cable
Twisted pair cableilakkiya
 
Network topology
Network topologyNetwork topology
Network topologyilakkiya
 
Looping statement in vb.net
Looping statement in vb.netLooping statement in vb.net
Looping statement in vb.netilakkiya
 
Conditional statement
Conditional statementConditional statement
Conditional statementilakkiya
 
Data types in php
Data types in phpData types in php
Data types in phpilakkiya
 
Array in php
Array in phpArray in php
Array in phpilakkiya
 
Decision statements in vb.net
Decision statements in vb.netDecision statements in vb.net
Decision statements in vb.netilakkiya
 
Addressing mode
Addressing modeAddressing mode
Addressing modeilakkiya
 

Plus de ilakkiya (10)

History object
History objectHistory object
History object
 
Twisted pair cable
Twisted pair cableTwisted pair cable
Twisted pair cable
 
Infrared
InfraredInfrared
Infrared
 
Network topology
Network topologyNetwork topology
Network topology
 
Looping statement in vb.net
Looping statement in vb.netLooping statement in vb.net
Looping statement in vb.net
 
Conditional statement
Conditional statementConditional statement
Conditional statement
 
Data types in php
Data types in phpData types in php
Data types in php
 
Array in php
Array in phpArray in php
Array in php
 
Decision statements in vb.net
Decision statements in vb.netDecision statements in vb.net
Decision statements in vb.net
 
Addressing mode
Addressing modeAddressing mode
Addressing mode
 

Dernier

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 

Dernier (20)

This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

Looping statement

  • 1. LOOPING STATEMENT IN PHP 1 www.YouStudy.IN
  • 2. Looping statement Loops execute a block of code a specified number of times, or while a specified condition is true. In PHP, the following looping statements are used: The While Loop The Do...While Loop The For Loop The Foreach Loop Break and Continue Statements 2 www.YouStudy.IN
  • 3. The while loop While structure is another type of loop statements, where the condition is checked at first, the iteration will not stop even if the value changes while executing statements. 3 www.YouStudy.IN
  • 4. Syntax while (condition) {  code to be executed;} 4 www.YouStudy.IN
  • 5. Example <?php$i=0;while ($i <= 10) { // Output values from 0 to 10   echo "The number is ".$i."<br />";   $i++;}?> 5 www.YouStudy.IN
  • 6. The do while loop Do While statement is same as the while statement, the only difference is that it evaluates the expression at the end. 6 www.YouStudy.IN
  • 7. Syntax do {   code to be exected;}while (condition); 7 www.YouStudy.IN
  • 8. Example <?php $i = 0;do {   echo "The number is ".$i."<br/>";   $i++;} while ($i <= 10);?> 8 www.YouStudy.IN
  • 9. The For Loop The for loop is used when you know in advance how many times the script should run. 9 www.YouStudy.IN
  • 10. Syntax for (initialization; condition; increment) {   code to be executed;} 10 www.YouStudy.IN
  • 11. For loop cont.. he For statement takes three expressions inside its parentheses, separated by semi-colons. When the For loop executes, the following occurs: The initializing expression is executed. This expression usually initializes one or more loop counters, but the syntax allows an expression of any degree of complexity. The condition expression is evaluated. If the value of condition is true, the loop statements execute. If the value of condition is false, the For loop terminates. The update expression increment executes. The statements execute, and control returns to step 2. 11 www.YouStudy.IN
  • 12. Example <?phpfor ($i=0; $i <= 10; $i++) {   echo "The number is ".$i."<br />";}?> 12 www.YouStudy.IN
  • 13. The Foreach Loop For Each structure is a loop structure used for arrays 13 www.YouStudy.IN
  • 14. Syntax foreach (array as value){   code to be executed;}    foreach (array as key => value){   code to be executed;} 14 www.YouStudy.IN
  • 15. Example <?php$email = array('john.smith@example.com', 'alex@example.com');foreach ($email as $value) {   echo "Processing ".$value."<br />";}?> 15 www.YouStudy.IN
  • 16. The break statement Break ends the execution of the for, for each, while, do-while or switch statement. 16 www.YouStudy.IN
  • 17. Syntax Break (Optional numeric argument) 17 www.YouStudy.IN
  • 18. Example <?php $c = 0; while (++$c) { switch ($c) { case 5: echo "At 5;"; break 1; case 10: echo "At 10; quitting"; break 2; default: break; } } ?> 18 www.YouStudy.IN
  • 19. The continue statement "Continue" is used to skip the current loop iteration and continue with the next iteration of the loop. But "Break" is used to exit from the whole loop. 19 www.YouStudy.IN
  • 20. Syntax Continue (Optional numeric argument); 20 www.YouStudy.IN
  • 21. Example <?php for ($c = 0; $c <=10; ++$c) { if ($c == 5) { continue; } print "$c "; } ?> 21 www.YouStudy.IN
  • 22. The End THANK U 22 www.YouStudy.IN