开发者

For loop of an array [closed]

开发者 https://www.devze.com 2023-02-01 19:50 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_运维百科 Closed 12 years ago.

I want to make check of array by using for loop. The check is if selected value display it also display its index.


Not sure what you are asking but my guess would be a foreach loop

$array = array("hello" => "world");

foreach($array as $key => $value) {
  echo "This is my index " . $key . " with it's value " . $value;

}

//prints This is my index hello with it's value world


You can have index by $key using foreach will help you.

for($array as $key=>$value){
if($selectedvalue){
echo $key." ".$value ;

}


}
0

精彩评论

暂无评论...
验证码 换一张
取 消