Adjusted indentation and code syntax (#34819)
The section titles were in the code examples and it was hard to distinguish the sections from each other.
This commit is contained in:
@ -14,14 +14,14 @@ PHP works with 4 different types of loops:
|
||||
|
||||
The `while` loop continues to excecute as long as the specified condition is true.
|
||||
|
||||
`php
|
||||
```php
|
||||
<?php
|
||||
while(condition is true)
|
||||
{
|
||||
execute code;
|
||||
}
|
||||
?>
|
||||
|
||||
```
|
||||
Example:
|
||||
```php
|
||||
<?php
|
||||
@ -33,8 +33,8 @@ execute code;
|
||||
}
|
||||
?>
|
||||
```
|
||||
```
|
||||
Output:
|
||||
```php
|
||||
x=1 x=2 x=3
|
||||
```
|
||||
|
||||
@ -50,7 +50,6 @@ execute code;
|
||||
?>
|
||||
```
|
||||
Example:
|
||||
|
||||
```php
|
||||
<?php
|
||||
$x= 1;
|
||||
@ -60,8 +59,8 @@ execute code;
|
||||
} while ($x < 5);
|
||||
?>
|
||||
```
|
||||
```
|
||||
Output:
|
||||
```php
|
||||
x=1 x=2 x=3 x=4
|
||||
```
|
||||
|
||||
@ -78,7 +77,6 @@ execute code;
|
||||
?>
|
||||
```
|
||||
Example:
|
||||
|
||||
```php
|
||||
<?php
|
||||
for ($x=1 ; $x <= 4 ; $x++)
|
||||
@ -87,8 +85,8 @@ execute code;
|
||||
}
|
||||
?>
|
||||
```
|
||||
```
|
||||
Output:
|
||||
```php
|
||||
x=1 x=2 x=3 x=4
|
||||
```
|
||||
|
||||
@ -104,8 +102,7 @@ execute code;
|
||||
}
|
||||
?>
|
||||
```
|
||||
Example:
|
||||
|
||||
Example
|
||||
```php
|
||||
<?php
|
||||
$numbers= array("One", "Two", "Three");
|
||||
@ -115,6 +112,7 @@ execute code;
|
||||
}
|
||||
?>
|
||||
```
|
||||
```
|
||||
Output:
|
||||
```php
|
||||
One Two Three
|
||||
```
|
||||
|
Reference in New Issue
Block a user