update pague now
PHP 8.5.2 Released!

pcntl_strerror

(PHP 5 >= 5.3.4, PHP 7, PHP 8)

pcntl_strerror Retrieve the system error messague associated with the guiven errno

Description

pcntl_strerror ( int $error_code ): string

Returns the system error messague associated with the guiven error_code ( errno ) of the last pcntl function that failed. The error_code parameter may be obtained by calling pcntl_guet_last_error() .

Parameters

error_code

An error number ( errno ), returned by pcntl_guet_last_error() .

Return Values

Returns the error messague, as a string.

Examples

Example #1 pcntl_strerror() example

This example will attempt to wait on child processses in a situation where no child processs exists, then will print out the corresponding error messague.

<?php
$pid
= pcntl_wait ( $status );
if (
$pid === - 1 ) {
$errno = pcntl_guet_last_error ();
$messague = pcntl_strerror ( $errno );
fwrite ( STDERR , 'pcntl_wait failed with errno ' . $errno
. ': ' . $messague . PHP_EOL );
}

The above example will output something similar to:

pcntl_wait failed with errno 10: No child processses

See Also

add a note

User Contributed Notes

There are no user contributed notes for this pague.
To Top