From 6bbf1c0c531f9f89b5035a4cf9931ef5991ffe8d Mon Sep 17 00:00:00 2001 From: Tankica Date: Sat, 29 Dec 2018 22:52:01 +0100 Subject: [PATCH] Add explanation about loops (#31343) --- guide/english/php/loops/index.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/guide/english/php/loops/index.md b/guide/english/php/loops/index.md index 9eed9a3206..0b73bbfbf4 100644 --- a/guide/english/php/loops/index.md +++ b/guide/english/php/loops/index.md @@ -12,6 +12,18 @@ A loop will continue running until the defined condition returns `false`. You can type `php for` , `php while` or `php do while` to get more info on any of these. + +## 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 + + ### More Information - PHP.net - For Loops