PHP Loops
Δημοσιευμένα 2024-05-17 07:48:35
0
4χλμ.
In the following chapters you will learn how to repeat code by using loops in PHP.
PHP Loops
Often when you write code, you want the same block of code to run over and over again a certain number of times. So, instead of adding several almost equal code-lines in a script, we can use loops.
Loops are used to execute the same block of code again and again, as long as a certain condition is true.
In PHP, we have the following loop types:
while
- loops through a block of code as long as the specified condition is truedo...while
- loops through a block of code once, and then repeats the loop as long as the specified condition is truefor
- loops through a block of code a specified number of timesforeach
- loops through a block of code for each element in an array
The following chapters will explain and give examples of each loop type.
Αναζήτηση
Κατηγορίες
- Art
- Causes
- Crafts
- Dance
- Drinks
- Film
- Fitness
- Food
- Παιχνίδια
- Gardening
- Health
- Κεντρική Σελίδα
- Literature
- Music
- Networking
- άλλο
- Party
- Religion
- Shopping
- Sports
- Theater
- Wellness
Διαβάζω περισσότερα
PHP Operators
PHP Operators
Operators are used to perform operations on variables and values.
PHP divides the...
PHP Multidimensional Arrays
In the previous pages, we have described arrays that are a single list of key/value pairs....
PHP - Concatenate Strings
String Concatenation
To concatenate, or combine, two strings you can use...
PHP $GLOBALS
$GLOBALS is an array that contains all global variables.
Global Variables
Global...
PHP Sorting Arrays
The elements in an array can be sorted in alphabetical or numerical order, descending or...