method searchContents documentation in bbn\File\System

function($search, $path, $deep = false, $hidden = false, $filter = 'file') { $res = []; if ($this->isDir($path)) { $files = $deep ? $this->scan($path, $filter) : $this->getFiles($path, false, $hidden, $filter); foreach ($files as $f) { $r = $this->searchContents($search, $f); if (count($r)) { if (is_array($search)) { foreach ($r as $s => $found) { if (count($found)) { if (!isset($res[$s])) { $res[$s] = []; } $res[$s][$f] = $found; } } } else { $res[$f] = $r; } } } return $res; } elseif ($this->isFile($path)) { $content = $this->getContents($path); if (is_array($search)) { foreach ($search as $s) { $idx = 0; $res[$s] = []; while (($n = X::indexOf($content, $s, $idx)) > -1) { $res[$s][] = $n; $idx = $n + strlen($s); } } } else { $idx = 0; while (($n = X::indexOf($content, $search, $idx)) > -1) { $res[] = $n; $idx = $n + 1; } } return $res; } return null; }

BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.