Function __global->find_unique_path
Definitions
sources/urls2.php
- Find a unique path on the filesystem, and corresponding URL and filename.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: array
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $subdir | string | No | No | required parameter | N/A | N/A | Subdirectory relative to base directory |
| $filename | ?string | No | No | Null | N/A | N/A | Filename (null: random) |
| $lock_in | boolean | No | No | False | N/A | N/A | Whether to write out an empty string to the file so that some other code (e.g. from another request) doesn't try and use the same path |
| $conflict_okay_if_matching | ?string | No | No | Null | N/A | N/A | Can use a duplicated file path if it matches this data (null: no check) |
Returns
- A tuple: path, relative URL for path, filename used
- Type: array
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Find a unique path on the filesystem, and corresponding URL and filename.
*
* @param string $subdir Subdirectory relative to base directory
* @param ?string $filename Filename (null: random)
* @param boolean $lock_in Whether to write out an empty string to the file so that some other code (e.g. from another request) doesn't try and use the same path
* @param ?string $conflict_okay_if_matching Can use a duplicated file path if it matches this data (null: no check)
* @return array A tuple: path, relative URL for path, filename used
*/
function find_unique_path(string $subdir, ?string $filename = null, bool $lock_in = false, ?string $conflict_okay_if_matching = null) : array
* Find a unique path on the filesystem, and corresponding URL and filename.
*
* @param string $subdir Subdirectory relative to base directory
* @param ?string $filename Filename (null: random)
* @param boolean $lock_in Whether to write out an empty string to the file so that some other code (e.g. from another request) doesn't try and use the same path
* @param ?string $conflict_okay_if_matching Can use a duplicated file path if it matches this data (null: no check)
* @return array A tuple: path, relative URL for path, filename used
*/
function find_unique_path(string $subdir, ?string $filename = null, bool $lock_in = false, ?string $conflict_okay_if_matching = null) : array

