Current location: Hot Scripts Forums » Programming Languages » PHP » array index question

array index question

 
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-01-09, 09:12 AM
jonnekke jonnekke is offline
Junior Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 642
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove value from array Nikas PHP 1 05-20-09 04:20 AM
Multi-Dimensional Array Help Nikas PHP 17 05-04-09 03:10 AM
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' Dr. Forensics PHP 3 07-15-06 04:54 PM
getting combinations of array index or elements karthikeyan PHP 1 03-27-06 12:11 PM
linking to iframe not working :( j0d JavaScript 5 01-19-04 09:14 PM


All times are GMT -5. The time now is 10:00 PM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.