title: php array : in one line, how to get an unknown value from a known key?
body: <p>I have this array - <strong>it is a multidimensional array, and i don't know the 0 index</strong> :</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [foo] =&gt; 1111
              [bar] =&gt; example
          )
  
  )
  </code></pre>
  
  <p>And I need, in one line, with native php functions, to get the value from the key <code>bar</code>. I tried much combination with <code>current</code>, <code>key</code>, <code>array_keys</code>, and so on.
  With <code>current($array)</code> I got : </p>
  
  <pre><code>Array
  (
      [foo] =&gt; 1111
      [bar] =&gt; example
  )
  </code></pre>
  
  <p>I discover <code>array_keys</code>, which allow me, with the second argument, to specify a value to find. But I didn't know the value, only the key, and <code>array_values</code> didnt propose a second argument to find (:o).</p>
  
  <p>Here I am now : <code>current(array_keys(array_flip(current($b))), 'bar')</code> didn't work. But  </p>
  
  <pre><code>$c = array_flip(current($b));
  print_r(current(array_keys($c, 'bar')));
  </code></pre>
  
  <p>works - I get "example". (By the way, why these 2 lines are working and not the previous one ?).</p>
  
  <p>And I know, it's ugly to use <code>array_flip</code> for this, but I don't know how to do otherwise. Any idea ? Thanks.</p>