private function getConsoleMode()
    {
        if (!function_exists('proc_open')) {
            return null;
        }

        $spec = [
            1 => ['pipe', 'w'],
            2 => ['pipe', 'w'],
        ];
        $process = proc_open('mode CON', $spec, $pipes, null, null, ['suppress_errors' => true]);
        if (is_resource($process)) {
            $info = stream_get_contents($pipes[1]);
            fclose($pipes[1]);
            fclose($pipes[2]);
            proc_close($process);

            if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
                return [(int) $matches[2], (int) $matches[1]];
            }
        }
        return null;
    }
private function getConsoleMode()
    {
        if (!function_exists('proc_open')) {
            return null;
        }

        $spec = [
            1 => ['pipe', 'w'],
            2 => ['pipe', 'w'],
        ];
        $process = proc_open('mode CON', $spec, $pipes, null, null, ['suppress_errors' => true]);
        if (is_resource($process)) {
            $info = stream_get_contents($pipes[1]);
            fclose($pipes[1]);
            fclose($pipes[2]);
            proc_close($process);

            if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
                return [(int) $matches[2], (int) $matches[1]];
            }
        }
        return null;
    }
private function getConsoleMode ( ) { if ( ! function_exists ( 'proc_open' ) ) { return null ; } $ spec = [ 1 => [ 'pipe' , 'w' ] , 2 => [ 'pipe' , 'w' ] , ] ; $ process = proc_open ( 'mode CON' , $ spec , $ pipes , null , null , [ 'suppress_errors' => true ] ) ; if ( is_resource ( $ process ) ) { $ info = stream_get_contents ( $ pipes [ 1 ] ) ; fclose ( $ pipes [ 1 ] ) ; fclose ( $ pipes [ 2 ] ) ; proc_close ( $ process ) ; if ( preg_match ( '/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/' , $ info , $ matches ) ) { return [ ( int ) $ matches [ 2 ] , ( int ) $ matches [ 1 ] ] ; } } return null ; }
Runs and parses mode CON if it's available, suppressing any error output.

@return int[]|null An array composed of the width and the height or null if it could not be parsed
Runs and parses mode CON if it s available suppressing any error output .