title: Switching two keys of an array
body: <p>I feel like I am so close to successfully switching Jim and Jill in this associative array. I ALSO would like it to be repeatable, so if 'Joe' is added to the end, it will also swap 'Jim' and 'Joe.' Any pointers?</p>
  
  <pre><code> &lt;?php
   function jim_is_jill($their_name) {
  
      $first = key($their_name);
  
      foreach ($their_name as $key =&gt; $value) {
          $lastmaybe = $key;
      }   
          $lastmaybe = $these;              // Lastmaybe is Jill
          $these     = $first;
  
          return $their_name;
   }  
  
   $their_name = array(
   //       Key   =&gt;  Value
           'Jim'   =&gt; 'dad', 
           'Josh'  =&gt; 'son', 
           'Jamie' =&gt; 'mom', 
           'Jane'  =&gt; 'daughter', 
           'Jill'  =&gt; 'daughter'
           );
  
   print_r(jim_is_jill($their_name));
   ?&gt;
  </code></pre>
  
  <p>CURRENT OUTPUT:</p>
  
  <pre><code>Array
  (
      [Jim] =&gt; dad
      [Josh] =&gt; son
      [Jamie] =&gt; mom
      [Jane] =&gt; daughter
      [Jill] =&gt; daughter
  )
  </code></pre>
  
  <p>DESIRED OUTPUT:</p>
  
  <pre><code>Array
  (
      [Jill] =&gt; dad
      [Josh] =&gt; son
      [Jamie] =&gt; mom
      [Jane] =&gt; daughter
      [Jim] =&gt; daughter
  )
  </code></pre>