PHP Tutorial - 13 - php for loop - php foreach loop- how to create for loop in php

Publicado em: 27 Setembro 2016
no canal de: Online Classes
2,515
16

PHP Loops
Often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal code-lines in a script, we can use loops to perform a task like this.

In PHP, we have the following looping statements:

while - loops through a block of code as long as the specified condition is true
do...while - loops through a block of code once, and then repeats the loop as long as the specified condition is true
for - loops through a block of code a specified number of times
foreach - loops through a block of code for each element in an array
Parameters:

init counter: Initialize the loop counter value
test counter: Evaluated for each loop iteration. If it evaluates to TRUE, the loop continues. If it evaluates to FALSE, the loop ends.
increment counter: Increases the loop counter value

The PHP foreach Loop
The foreach loop works only on arrays, and is used to loop through each key/value pair in an array.

~-~~-~~~-~~-~
Please watch: "Php hacks : How to create website step by step using php and mysql : part 8"
   • Php hacks : How to create website ste...  
~-~~-~~~-~~-~


Nesta página do site você pode assistir ao vídeo on-line PHP Tutorial - 13 - php for loop - php foreach loop- how to create for loop in php duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Online Classes 27 Setembro 2016, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 2,515 vezes e gostou 16 espectadores. Boa visualização!