title: Use unset result without defining a new array in php
body: <p>I am trying to create a dynamic link, in this way:<br></p>
  
  <ul>
  <li>Take an array</li>
  <li>Search for the key of one element</li>
  <li>Delete this element</li>
  <li>Implode the array elements to a string</li>
  <li>Show the string as a parameter in the link</li>
  </ul>
  
  <p>I am doing it like it follows:</p>
  
  <pre><code> $url_langs=array('fra','cat','hun'...); //CURRENT LANGS in use
  
   $all_langs=array('eng','fra','por','ser','cat','dan','hun','fin','est','esl',...);
  
   foreach($all_langs as $lang){
      echo (in_array($lang,$url_langs))?'&lt;a href="' . implode('|',unset($url_langs[array_search($lang,$url_langs)])) . '"&gt;' . $lang . '&lt;/b&gt; ':'&lt;a href="' . implode('|',$url_langs) . '|' . $lang . '"&gt;' . $lang . '&lt;/a&gt; ';
   }
  </code></pre>
  
  <p>Well, as you can see. I iterate the array which contains all the available languages, and check if it is already in use or not. If it is in use, I show a link to not use it; and the same for the contrary case.</p>
  
  <p>As the <a href="http://php.net/manual/en/function.unset.php" rel="nofollow">php manual (unset)</a> says: <em>"No value is returned."</em>. So I can't use unset on the fly. My questions are:</p>
  
  <ol>
  <li>Is there any <strong>alternative form</strong> to achieve it?</li>
  <li>I could use the long <code>if</code> sentence, and define a new array which I will then use for the implode() function. But, isn't it strange? Crate a new array if my goal is make it as plain text?</li>
  <li>I could use a str_replace to remove this part of the string once imploded... but this I can't do it on the fly, neither.</li>
  </ol>
  
  <p>Thanks a lot.</p>