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.
|
The `while` loop continues to excecute as long as the specified condition is true.
|
||||||
|
|
||||||
`php
|
```php
|
||||||
<?php
|
<?php
|
||||||
while(condition is true)
|
while(condition is true)
|
||||||
{
|
{
|
||||||
execute code;
|
execute code;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
```
|
||||||
Example:
|
Example:
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
@ -33,8 +33,8 @@ execute code;
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
```
|
```
|
||||||
```
|
|
||||||
Output:
|
Output:
|
||||||
|
```php
|
||||||
x=1 x=2 x=3
|
x=1 x=2 x=3
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -50,7 +50,6 @@ execute code;
|
|||||||
?>
|
?>
|
||||||
```
|
```
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
$x= 1;
|
$x= 1;
|
||||||
@ -60,8 +59,8 @@ execute code;
|
|||||||
} while ($x < 5);
|
} while ($x < 5);
|
||||||
?>
|
?>
|
||||||
```
|
```
|
||||||
```
|
|
||||||
Output:
|
Output:
|
||||||
|
```php
|
||||||
x=1 x=2 x=3 x=4
|
x=1 x=2 x=3 x=4
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -78,7 +77,6 @@ execute code;
|
|||||||
?>
|
?>
|
||||||
```
|
```
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
for ($x=1 ; $x <= 4 ; $x++)
|
for ($x=1 ; $x <= 4 ; $x++)
|
||||||
@ -87,8 +85,8 @@ execute code;
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
```
|
```
|
||||||
```
|
|
||||||
Output:
|
Output:
|
||||||
|
```php
|
||||||
x=1 x=2 x=3 x=4
|
x=1 x=2 x=3 x=4
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -104,8 +102,7 @@ execute code;
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
```
|
```
|
||||||
Example:
|
Example
|
||||||
|
|
||||||
```php
|
```php
|
||||||
<?php
|
<?php
|
||||||
$numbers= array("One", "Two", "Three");
|
$numbers= array("One", "Two", "Three");
|
||||||
@ -115,6 +112,7 @@ execute code;
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
```
|
```
|
||||||
```
|
|
||||||
Output:
|
Output:
|
||||||
|
```php
|
||||||
One Two Three
|
One Two Three
|
||||||
|
```
|
||||||
|
Reference in New Issue
Block a user