title: PHP method of function for remove child dirs on array
body: <p>I create a function for remove child dirs on arrays structure. USer for error or mistake, has put on scenario, subdirs child of a parent dir already in config list.</p>
  
  <pre><code>/dir_a/subdir_a
  /dir_b/subdir_a/subdir_a
  /dir_b/subdir_a/subdir_b
  /dir_b/
  /dir_c/subdir_a/
  ...
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>$local_pre_order = array_unique($local_sync);
  asort($local_pre_order);
  $local_order = array();
  foreach ($local_pre_order as $value)
  {
      $repeat = false;
      foreach ($local_pre_order as $value2)
      {
         $pos = strpos($value,$value2);
         if (($pos !== false ) &amp;&amp; ($value != $value2) &amp;&amp; ($pos == 0)) {
            $repeat = true;
            break;
         }
      }
      if (!$repeat) {
         $local_order[] = $value;
      }
  }
  </code></pre>
  
  <p>Sort OK</p>
  
  <pre><code>/dir_a/subdir_a
  /dir_b/
  /dir_c/subdir_a/
  </code></pre>
  
  <p>I think it's a no good programing. Work but not fine. IMHO. Any ideas for best code? </p>