gwolgamott Posted February 4, 2010 Share Posted February 4, 2010 Running a recursive function iterating through an array. So I get the values as needed, but I need somehow to put into this function the key of that value... for example have this array Array ( [Man Sys Do] => Array ( [Random] => Array ( [0] => LINK_ME ) [s & R] => Array ( [Recieving] => Array ( [0] => LINK_ME ) [shipping] => Array ( [0] => LINK_ME ) ) ) ) How do find out that after going through a function to print this or whatever and say I have the LINK_ME how do I then afterwards before leaving my function determine what its key was and if that key had a key itself and so on... so I can get something like this "Man Sys Do" : "S & R" : "Shipping" -> LINK_ME EDIT: would this best be done with a variable passed to my recursive function? Link to comment https://forums.phpfreaks.com/topic/190934-finding-the-key-of-a-value-of-an-array-when-that-value-is-an-array/ Share on other sites More sharing options...
gwolgamott Posted February 4, 2010 Author Share Posted February 4, 2010 answered my own question... in case anyone was interested here are two lines to do that. $key_sub = $key_sub."/".$key; Nav_Link($value, $key_sub); Link to comment https://forums.phpfreaks.com/topic/190934-finding-the-key-of-a-value-of-an-array-when-that-value-is-an-array/#findComment-1006863 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.