y the way, if those streams are redirected to a file, the VT100 features may not be enabled. * * If VT100 support is enabled, it is possible to use control sequences as they are known from the VT100 terminal. * They allow the modification of the terminal's output. On Windows these sequences are called Console Virtual Terminal Sequences. * * @param resource $stream The stream on which the function will operate. * @param bool $enable If specified, the VT100 feature will be enabled (if TRUE) or disabled (if FALSE). * @throws MiscException * */ function sapi_windows_vt100_support($stream, bool $enable = null): void { error_clear_last(); if ($enable !== null) { $result = \sapi_windows_vt100_support($stream, $enable); } else { $result = \sapi_windows_vt100_support($stream); } if ($result === false) { throw MiscException::createFromPhpError(); } } /** * * * @param int $seconds Halt time in seconds. * @return int Returns zero on success. * * If the call was interrupted by a signal, sleep returns * a non-zero value. On Windows, this value will always be * 192 (the value of the * WAIT_IO_COMPLETION constant within the Windows API). * On other platforms, the return value will be the number of seconds left to * sleep. * @throws MiscException * */ function sleep(int $seconds): int { error_clear_last(); $result = \sleep($seconds); if ($result === false) { throw MiscException::createFromPhpError(); } return $result; } /** * Delays program execution for the given number of * seconds and nanoseconds. * * @param int $seconds Must be a non-negative integer. * @param int $nanoseconds Must be a non-negative integer less than 1 billion. * @return array{0:int,1:int}|bool Returns TRUE on success. * * If the delay was interrupted by a signal, an associative array will be * returned with the components: * * * * seconds - number of seconds remaining in * the delay * * * * * nanoseconds - number of nanoseconds * remaining in the delay * * * * @throws MiscException * */ function time_nanosleep(int $seconds, int $nanoseconds) { error_clear_last(); $result = \time_nanosleep($seconds, $nanoseconds); if ($result === false) { throw MiscException::createFromPhpError(); } return $result; } /** * Makes the script sleep until the specified * timestamp. * * @param float $timestamp The timestamp when the script should wake. * @throws MiscException * */ function time_sleep_until(float $timestamp): void { error_clear_last(); $result = \time_sleep_until($timestamp); if ($result === false) { throw MiscException::createFromPhpError(); } } /** * Unpacks from a binary string into an array according to the given * format. * * The unpacked data is stored in an associative array. To * accomplish this you have to name the different format codes and * separate them by a slash /. If a repeater argument is present, * then each of the array keys will have a sequence number behind * the given name. * * @param string $format See pack for an explanation of the format codes. * @param string $data The packed data. * @param int $offset The offset to begin unpacking from. * @return array Returns an associative array containing unpacked elements of binary * string. * @throws MiscException * */ function unpack(string $format, string $data, int $offset = 0): array { error_clear_last(); $result = \unpack($format, $data, $offset); if ($result === false) { throw MiscException::createFromPhpError(); } return $result; }