爲什麼$ k每次都通過循環重置爲零?
$fruit = array (「orange」, 「apple」, 「grape」);
$testvar = 「no」;
while ($testvar != 「yes」) {
$k = 0;
if ($fruit[$k] == 「apple」) {
$testvar = 「yes」;
echo 「apple\n」;
} else {
echo 「$fruit[$k] is not an apple\n」;
}
$k++;
}
在while語句前放置'$ k' – 2014-09-25 04:26:51