mOrloff
03-14-2009, 10:05 PM
I'm sure it's simple, but what am I missing?
When I run this:
$test=array('to','the','moon','alice');
if(is_array($test)){
$rowCount=count($test);
$i=0;
while($i<=$rowCount){
$var=$test[$i];
switch($var){
case "to":
$blah="To";
break;
case "the":
$blah=" the";
break;
case " moon":
$blah="moon";
break;
case "alice":
$blah=" Alice!";
break;
}
print $blah;
$i++;
}
I am getting "To the moon Alice! Alice!".
Why am I getting a repeat on my last value?
~ Mo
When I run this:
$test=array('to','the','moon','alice');
if(is_array($test)){
$rowCount=count($test);
$i=0;
while($i<=$rowCount){
$var=$test[$i];
switch($var){
case "to":
$blah="To";
break;
case "the":
$blah=" the";
break;
case " moon":
$blah="moon";
break;
case "alice":
$blah=" Alice!";
break;
}
print $blah;
$i++;
}
I am getting "To the moon Alice! Alice!".
Why am I getting a repeat on my last value?
~ Mo