View Single Post
  #1 (permalink)  
Old 07-01-09, 09:12 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 704
Thanks: 0
Thanked 0 Times in 0 Posts
array index question

Hi there,

I got this array issue:

this array I use on my site:

PHP Code:

$nbr = Array ( [solutionactief1] => yes, [solutionpositie1] =>, [solutionactief2] => yes, [solutionpositie2] => [eventpositie3] => ); 

I search this array for a key with the value "yes"
PHP Code:

$tel_yes 0;
foreach (
$nbr as $value) {
    if(
$value =="yes"){    
        echo 
"- ".$value." | ".$tel_yes."<br>";
    }    
    
$tel_yes++;
}                            
unset(
$value); 
Now I'm looking to get the name of the index. F.E. if "solutionactief1" is "yes" I need the "solutionposition1" as well.
So I thought to substract the "1" out of the index name and combine this with "solutionposition" to get "solutionposition1".

But I can't catch the index name.. Who can help me out here?.

_j
Reply With Quote