<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1044732" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1044732</link>
    <description></description>
    <language>en</language>
          <item>
    <title>Hmm, I should probably have</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/get-value-array-where-another-value-matched#comment-1244430</link>
    <description> &lt;p&gt;Hmm, I should probably have mentioned (sorry) it&#039;s a Wordpress site.&lt;br /&gt;
The array is built in the core (I could edit it but wont) and is for a navigation menu.&lt;/p&gt;
&lt;p&gt;This is to show breadcrumbs for the current nav position.&lt;br /&gt;
The array is in the same order as long as the WP categories remain the same.&lt;/p&gt;
&lt;p&gt;I can&#039;t really use a binary search as it&#039;s a value from a different key I want.&lt;br /&gt;
The array is multi dimensional. So I need to search each sub arrays to match a particular key&#039;s value but actually get another key&#039;s value if matched (same sub array though).&lt;/p&gt;
&lt;p&gt;I already have a loop for the nav, and need to get the breadcrumbs prior to looping and showing the nav. I really don&#039;t want to loop the same array twice in succession. &lt;/p&gt;
&lt;p&gt;Looks a parallel array as you suggested will be the best option here.&lt;br /&gt;
Loop to do the breadcrumbs and make a second array. I only use 3 of the values from the huge array anyway so making a second isn&#039;t too big of an issue.&lt;/p&gt;
&lt;p&gt;I just thought there might be a way to search and match an array value and then get another key&#039;s value if matched.&lt;br /&gt;
Probably asking too much of the ol&#039; PHP system.&lt;/p&gt;
 </description>
     <pubDate>Sat, 22 Aug 2009 19:54:00 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1244430 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>If the array is huge, and</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/get-value-array-where-another-value-matched#comment-1244426</link>
    <description> &lt;p&gt;If the array is huge, and your array looks like that (it has fields), why aren&#039;t you letting a relation databases handle this for you? &lt;/p&gt;
&lt;p&gt;Is your array in any particular order? If it is, you would still need a loop, but you could use a binary search to find a name. That would bring search time down a ton. &lt;/p&gt;
&lt;p&gt;Another idea, which would use a lot of space, would be to create a parallel array which has the &lt;em&gt;names as keys&lt;/em&gt;, and the &lt;em&gt;index (of the other array) as values&lt;/em&gt;.&lt;/p&gt;
 </description>
     <pubDate>Sat, 22 Aug 2009 17:51:00 +0000</pubDate>
 <dc:creator>teammatt3</dc:creator>
 <guid isPermaLink="false">comment 1244426 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
