Forum Moderators: coopster
So, in untested psuedocode:
$array_of_possibilities = ('red', 'blue', 'one', 'two');
$array_of_choices = ('blue','one');
foreach($array_of_possibilities as $possible_choice){
if(array_search($possible_choice, $array_of_choices)!==FALSE){
echo 'Yes - '.$possible_choice;
} else {
echo 'No - '.$possible_choice;
}
}
Added: I hope this is helpful -- I know pretty much nothing about ASP or .NET.
<?
$mystuff = array();
$mystuff[] = array(001,01);
$mystuff[] = array(001,02);
$mystuff[] = array(001,03);
$mystuff[] = array(002,02);
$mystuff[] = array(003,01);
$mystuff[] = array(003,03);
echo '<pre><b>stuff:</b><br>';
print_r($mystuff);
echo '</pre>';
$mynewstuff = array();
$counter = 0;
while (isset($mystuff[$counter][0])) {
$mynewstuff["{$mystuff[$counter][0]}"]["{$mystuff[$counter][1]}"] = 'yes';
$counter++;
}
echo '<p><pre><b>newstuff:</b><br>';
print_r($mynewstuff);
echo '</pre>';
?>
this just rebuilds the array for easy output. It does rely on the existence of sequential ids but you could get around it by using a for each on output.