php do while
先执行do,在判断while
源码:
<?php
$x = 1;
do {
echo "x is :<br>";
$x++;
}while($x<=5);
$y = 6;
do {
echo "y is :<br>";
$y++;
} while ($y<=5);
?>
输出:
x is 1
x is 2
x is 3
x is 4
x is 5
y is 6
php do while
先执行do,在判断while
源码:
<?php
$x = 1;
do {
echo "x is :<br>";
$x++;
}while($x<=5);
$y = 6;
do {
echo "y is :<br>";
$y++;
} while ($y<=5);
?>
输出:
x is 1
x is 2
x is 3
x is 4
x is 5
y is 6