For loop of an array [closed]
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 ;
}
}
加载中,请稍侯......
精彩评论