title: Issue about correct and fast seeking in array
body: <p>I have a question about correct and fast seeking in php array.</p>
  
  <p>I have input array:</p>
  
  <pre><code>array (size=2)
    0 =&gt; 
      array (size=7)
        'Videos' =&gt; 
          array (size=2)
            240 =&gt; 
              array (size=2)
                ...
            120 =&gt; 
              array (size=2)
                ...
        'Texts' =&gt; 
          array (size=0)
            empty
        'Price' =&gt; float 0
        'QaAudio' =&gt; int 1
        'QaVideo' =&gt; int 3
        'Level' =&gt; string 'normal' (length=6)
        'PreviewPic' =&gt; 
          array (size=7)
            40 =&gt; 
              array (size=12)
                ...
            60 =&gt; 
              array (size=12)
                ...
            140 =&gt; 
              array (size=12)
                ...
            160 =&gt; 
              array (size=12)
                ...
            320 =&gt; 
              array (size=12)
                ...
            640 =&gt; 
              array (size=12)
                ...
            1024 =&gt; 
              array (size=12)
                ...
    1 =&gt; 
      array (size=7)
        'Videos' =&gt; 
         array (size=3)
            480 =&gt; 
              array (size=2)
                ...
            360 =&gt; 
              array (size=2)
                ...
            120 =&gt; 
              array (size=2)
                ...
        'Texts' =&gt; 
          array (size=0)
            empty
        'Price' =&gt; float 0
        'QaAudio' =&gt; int 1
        'QaVideo' =&gt; int 3
        'Level' =&gt; string 'sexy' (length=4)
        'PreviewPic' =&gt; 
          array (size=7)
            40 =&gt; 
              array (size=12)
                ...
            60 =&gt; 
              array (size=12)
                ...
            140 =&gt; 
              array (size=12)
                ...
            160 =&gt; 
              array (size=12)
                ...
            320 =&gt; 
              array (size=12)
                ...
            640 =&gt; 
              array (size=12)
                ...
            1024 =&gt; 
              array (size=12)
                ...
  </code></pre>
  
  <p>I need to find in it the video, that has max value in Videos key.(it has 360,240,120 values as you can see in example) and has Level Key that equal to 'normal' or 'sexy' value.</p>
  
  <p>I wrote some method to do it:</p>
  
  <pre><code>public function getPresentationVideo($id)
      {
          $result = [];
          $notHardVideos = [];
          $profileVideos = $this-&gt;getProfilesVideos($id,0,50);
          if ($profileVideos &amp;&amp; count($profileVideos) &gt; 0) {
              foreach ($profileVideos as $video) {
                  if (in_array($video['Level'],['normal','sexy'])) {
                      $video['maxVideoQuality'] = max(array_keys($video['Videos']));
                      $notHardVideos[] = $video;
                  }
              }
              $keyForMaxQuality = 0;
              if (count($notHardVideos) &gt; 1) {
                  $maxQuality = 0;
                  foreach($notHardVideos as $key =&gt; $video) {
                      if($video['maxVideoQuality'] &gt; $maxQuality)
                      {
                          $maxQuality = $video['maxVideoQuality'];
                          $keyForMaxQuality = $key;
                      }
                  }
              }
              if (count($notHardVideos) &gt; 0) {
                  $result = $notHardVideos[$keyForMaxQuality];
                  unset($result['maxVideoQuality']);
              }
          }
  
          return $result;
      }
  </code></pre>
  
  <p>It do it well.</p>
  
  <p>But i wonder is there any more effective way to do it.
  Do you have any ideas?</p>
  
  <p>Thanks in advance.</p>