title: How to set array first element dynamically with php
body: <p>I have a php array as follows,</p>
  
  <pre><code>&lt;?php
      $arr = array('op'=&gt;'pqr', 'ab'=&gt;'xyz', 'mn'=&gt;'abcd');
  
  ?&gt;
  </code></pre>
  
  <p>How to set <code>xyz</code> value as first element with minimum loop,if the value exist.</p>
  
  <p>Expected Result</p>
  
  <pre><code>&lt;?php
      $arr = array('ab'=&gt;'xyz', 'op'=&gt;'pqr','mn'=&gt;'abcd');
  ?&gt;
  </code></pre>