ftok()
ftok() — Convert a pathname and a project identifier to a System V IPC key.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
The function converts the filename of an existing accessible file and a project identifier into an integer for use with for example shmop_open() and other System V IPC keys.
Signature
ftok(string $filename, string $project_id): int
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $filename | string | Path to an accessible file. |
| $project_id | string | Project identifier. This must be a one character string. |
Return value
On success the return value will be the created key value, otherwise -1 is returned.
Example
The PHP manual ships no example for ftok(); the signature and the parameter table above are the contract.
All PHP 8.5 built-in functions
Reference card built from the PHP manual page ftok() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.