Function Commandr_fs->search
Definitions
sources/commandr_fs.php
- Return a listing of all the files/directories found matching the specified pattern. Equivalent to Unix "find".
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: array
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $pattern | string | No | No | required parameter | N/A | N/A | The search pattern (PRCE regexp or plain) |
| $regexp | boolean | No | No | False | N/A | N/A | Is the search pattern a regexp? |
| $recursive | boolean | No | No | False | N/A | N/A | Should the search be recursive? |
| $files | boolean | No | No | True | N/A | N/A | Should files be included in the results? |
| $directories | boolean | No | No | False | N/A | N/A | Should directories be included in the results? |
| $dir | ?array | No | No | Null | N/A | N/A | Directory (null: current directory is used) |
Returns
- The search results
- Type: array
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Return a listing of all the files/directories found matching the specified pattern. Equivalent to Unix "find".
*
* @param string $pattern The search pattern (PRCE regexp or plain)
* @param boolean $regexp Is the search pattern a regexp?
* @param boolean $recursive Should the search be recursive?
* @param boolean $files Should files be included in the results?
* @param boolean $directories Should directories be included in the results?
* @param ?array $dir Directory (null: current directory is used)
* @return array The search results
*/
public function search(string $pattern, bool $regexp = false, bool $recursive = false, bool $files = true, bool $directories = false, ?array $dir = null) : array
* Return a listing of all the files/directories found matching the specified pattern. Equivalent to Unix "find".
*
* @param string $pattern The search pattern (PRCE regexp or plain)
* @param boolean $regexp Is the search pattern a regexp?
* @param boolean $recursive Should the search be recursive?
* @param boolean $files Should files be included in the results?
* @param boolean $directories Should directories be included in the results?
* @param ?array $dir Directory (null: current directory is used)
* @return array The search results
*/
public function search(string $pattern, bool $regexp = false, bool $recursive = false, bool $files = true, bool $directories = false, ?array $dir = null) : array

