Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

pcntl_signal_get_handler

Description

The pcntl_signal_get_handler of PCNTL for PHP gets the current handler for the specified signal.

Syntax

pcntl_signal_get_handler(
    int $signal
): callable|int

Parameters

signal

The signal number.

Return

Returns the integer value that refers to SIG_DFL or SIG_IGN or the callable if a custom handler has been set.

Examples

1 · signal

<?

$signal = SIGHUP;

$return = pcntl_signal_get_handler($signal);

echo $return;

?>
0

2 · pcntl_signal · handler · SIG_DFL

<?

$signal = SIGHUP;
$handler = SIG_DFL;

pcntl_signal($signal, $handler);

$return = pcntl_signal_get_handler($signal);

echo $return;

?>
0

3 · pcntl_signal · handler · SIG_IGN

<?

$signal = SIGHUP;
$handler = SIG_IGN;

pcntl_signal($signal, $handler);

$return = pcntl_signal_get_handler($signal);

echo $return;

?>
1

4 · pcntl_signal · handler · callable

<?

function handler($signo, $siginfo)
{
}

$signal = SIGHUP;
$handler = "handler";

pcntl_signal($signal, $handler);

$return = pcntl_signal_get_handler($signal);

echo $return;

?>
handler
HomeMenu