- 从数组中读取文件名
- 在数组值中搜索字符串"-dep",如果任何字符串值包含"-dep",请将其删除
- 将数组作为值传递给另一个数组
for($d=0; $d < $files; ++$d)
{
if(strpos($files[$d], "-dep") === true)
{
unset($files[$d]);
}
}
return array($dnum, $fnum, $dirs, $files);
您可以使用array_filter
我不知道这是否是最好的方法,但我会做这个
foreach($array as $key=$value)
{
if(strstr($value, '-dep'))
unset($array[$key]);
}