title: Frustration at trying to output two specific values from an Array
body: <p>I am doing my head in trying to do a simple retrieval for specific arrays within a script so I have an original associative array:</p>
  
  <pre><code>$vNArray ['Brandon']  = $item[3]; 
  $vNArray['Smith']= $item[4]; 
  $vNArray ['Johnson']= $item[5];
  $vNArray ['Murphy']= $item[6];
  $vNArray ['Lepsky']= $item[7];
  </code></pre>
  
  <p>Which outputs a common result for most values:</p>
  
  <pre><code>foreach ($vNArray as $key =&gt; $value){
  
   if(!empty($value)){
      $result  .= "\t\t\t\t&lt;li&gt;&lt;strong&gt;$key&lt;/strong&gt;"  .$value.   "&lt;/li&gt;\n";
   }
  </code></pre>
  
  <p>But then I want two of these arrays to render differently so I added another script suggested by someone:</p>
  
  <pre><code>$display_id=array('Brandon', 'Murphy');
  
  foreach ($vNArray as $key =&gt; $value){
    if(!empty($value)){
      //Looks into the display_id array and renders it differently
      if (in_array($key, $display_id)) {
      $result  .= "\t\t\t\t&lt;li id=\"$key\"&gt;&lt;strong&gt;$key&lt;/strong&gt;$value&lt;/li&gt;\n";
      } else {
      $result .= "\t\t\t\t&lt;li&gt;&lt;strong&gt;$key&lt;/strong&gt;$value&lt;/li&gt;\n";
      }
    }
  </code></pre>
  
  <p>}</p>
  
  <p>The problem is that i want the result for these arrays to contain both within the first result but when I tried to output 
      $result  .= "\t\t\t\t<strong>$key[1]</strong>".$value[1]." </li>\n";</p>
  
  <p>PHP thinks that the index is the value's character index, so I'm having major syntax issues like id="/" <strong>r</strong>.</p>
  
  <p>I have also tried </p>
  
  <pre><code>$result  .= "\t\t\t\t&lt;li id=\"". $display_id['Brandon']$value.\""&gt;&lt;strong&gt;$key[1]&lt;/strong&gt;". $display_id['Murphy']$value." &lt;/li&gt;\n";
  </code></pre>
  
  <p>But I am still getting wrong syntax issues...like</p>
  
  <pre><code>syntax error, unexpected T_VARIABLE
  </code></pre>
  
  <p>Or some other error like this. </p>
  
  <p>Could someone please help?</p>
  
  <p>EDITED</p>
  
  <hr>
  
  <p>I have made the syntax corrections but I still need to specify the index:</p>
  
  <p>The result from</p>
  
  <pre><code>result  .= "\t\t\t\t&lt;li id=\"". $display_id['Brandon'] . $value."\"&gt;&lt;strong&gt;" .   $key[1] . "&lt;/strong&gt;". $display_id['Murphy'] . $value." &lt;/li&gt;\n";
  </code></pre>
  
  <p>Needs to be (Note how each value is on the same output depending on what I'm targeting):</p>
  
  <pre><code>&lt;li id="Brandon Value"&gt;&lt;strong&gt;Brandon&lt;/strong&gt; Murphy Value&lt;/li&gt;
  </code></pre>
  
  <p>Right now it ignores the index value of . $display_id['Brandon'] . $value. or . $display_id['Murphy'] . $value." all together and just repeats:</p>
  
  <pre><code>&lt;li id="Brandon Value"&gt;&lt;strong&gt;Brandon&lt;/strong&gt; Brandon Value&lt;/li&gt;
  &lt;li id="Murphy Value"&gt;&lt;strong&gt;Murphy&lt;/strong&gt; Murphy Value&lt;/li&gt;
  </code></pre>