pcntl_waitid
Waits for a child process to change state.
pcntl_waitid Function synopsis
pcntl_waitid(
int $idtype = P_ALL,
?int $id = null,
&$info = [],
int $flags = WEXITED,
&$resource_usage = []
): bool
Parameters
$idtype
OptionalTypeintDefault valueP_ALL
$id
OptionalType?intDefault valuenull
$info
Passed by reference, OptionalDefault value[]
The $info parameter is set to an array
containing information about the signal.
$flags
OptionalTypeintDefault valueWEXITED
The value of $flags is the value of zero or more of
the following constants OR'ed together:
$resource_usage
Passed by reference, OptionalDefault value[]
Note that the parameters
$infoand$resource_usageare passed by reference, and contain additional/updated context data that may be useful.
Return value
Typebool
pcntl_waitid returns true if
WNOHANG was specified and status is not available for
any process specified by $idtype and
$id.
pcntl_waitid returns true due to the change of state
of one of its children.
Otherwise, false is returned and pcntl_get_last_error
can be used to get the errno error number.
Once an `errno` error number has been obtained,
[`pcntl_strerror`](/codex/pcntl_strerror) can be used to get the text message
associated with it. Changes to the pcntl_waitid Function
PHP 8.5
- Optional parameter added - #5:
&$resource_usage = []
pcntl_waitid(
int $idtype = P_ALL,
?int $id = null,
&$info = [],
- int $flags = WEXITED
+ int $flags = WEXITED,
+ &$resource_usage = []
): bool PHP 8.4
- Function added
pcntl_waitid Function Availability
pcntl_waitid Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.7Future Release | Yes |
| PHP 8.6Upcoming Release | Yes |
| PHP 8.5Supported (Latest) | Yes |
| PHP 8.4Supported | Yes |
| PHP 8.3Security-Fixes Only | No |
| PHP 8.2Security-Fixes Only | No |
| PHP 8.1Unsupported | No |
| PHP 8.0Unsupported | No |
| PHP 7.4Unsupported | No |
| PHP 7.3Unsupported | No |
| PHP 7.2Unsupported | No |
| PHP 7.1Unsupported | No |
| PHP 7.0Unsupported | No |
| PHP 5.6Unsupported | No |
| PHP 5.5Unsupported | No |
| PHP 5.4Unsupported | No |
| PHP 5.3Unsupported | No |