-7
  1. Read the file names from the array.
  2. Search the array value for the string "-dep" and if any string value contains "-dep", remove it.
  3. Pass the array as as value to another array

.

for($d=0; $d < $files; ++$d)
{
    if(strpos($files[$d], "-dep") === true)
    {
      unset($files[$d]);
    }
}
return array($dnum, $fnum, $dirs, $files);
John Conde
  • 217,595
  • 99
  • 455
  • 496
codename32
  • 171
  • 1
  • 9

2 Answers2

2

You can do this with array_filter

CrayonViolent
  • 32,111
  • 5
  • 56
  • 79
0

I don't know if it is the best method for doing so but I would do this

foreach($array as $key=$value)
{
    if(strstr($value, '-dep'))
        unset($array[$key]);
}
Ding
  • 3,065
  • 1
  • 16
  • 27