title: PHP built methods for manipulating an array based on condition
body: <p>The below is my array and I wanted to check a condition and do an array manipulation in an effective way. Which are, </p>
  
  <ol>
  <li>I have to check if, <code>resourceContext</code> in the below array is <code>10</code> or <code>11</code>. </li>
  <li>If it's <code>10</code> I wanted the array's name index to be replaced with
  it's own value to be.
  from <code>"name" =&gt; "Agency FB Bold"</code> to <code>"Agency FB Bold" =&gt; "/var/opt/nc/downloads/54007"</code> which is <code>fileReference</code>'s value. This is because it's <code>resourceContext</code>'s value is <code>11</code>. </li>
  <li>In case if it's <code>resourceContext</code> value is <code>10</code> then <code>"Agency FB Bold"</code>s index value should be  the value of <code>pclFontNumber</code> which will make the <code>"Agency FB Bold" =&gt; "54007"</code></li>
  </ol>
  
  <p><code>$gAllFonts = array("mFontList" =&gt; array(array("name" =&gt; "Agency FB Bold", "pclFontNumber" =&gt; "54007", "fontType" =&gt; "0", "fileReference" =&gt; "/var/opt/nc/downloads/54007", "resourceContext" =&gt; "11"), array("name" =&gt; "Albertus Extra Bold", "pclFontNumber" =&gt; "53056", "fontType" =&gt; "0", "fileReference" =&gt; "/var/opt/nc/downloads/53056", "resourceContext" =&gt; "10"), array("name" =&gt; "Albertus Medium", "pclFontNumber" =&gt; "53041", "fontType" =&gt; "0", "fileReference" =&gt; "/var/opt/nc/downloads/53041", "resourceContext" =&gt; "10"), array("name" =&gt; "Antique Olive", "pclFontNumber" =&gt; "52795", "fontType" =&gt; "0", "fileReference" =&gt; "/var/opt/nc/downloads/52795", "resourceContext" =&gt; "10")));</code></p>
  
  <p>How this manipulation should be done using PHP built in methods?</p>
  
  <p>I tried with <code>array pop</code> and <code>array previous</code> array next` but couldn't get the right way.</p>