private static function getSttyColumns()
    {
        $info = static::runCommand('stty -a | grep columns');

        if ($info && preg_match('/rows.(\d+);.columns.(\d+);/i', $info, $matches)) {
            // extract [w, h] from "rows h; columns w;"
        } elseif ($info && preg_match('/;.(\d+).rows;.(\d+).columns/i', $info, $matches)) {
            // extract [w, h] from "; h rows; w columns"
        } else {
            return [];
        }

        return [(int) $matches[2], (int) $matches[1]];
    }
private static function getSttyColumns()
    {
        $info = static::runCommand('stty -a | grep columns');

        if ($info && preg_match('/rows.(\d+);.columns.(\d+);/i', $info, $matches)) {
            // extract [w, h] from "rows h; columns w;"
        } elseif ($info && preg_match('/;.(\d+).rows;.(\d+).columns/i', $info, $matches)) {
            // extract [w, h] from "; h rows; w columns"
        } else {
            return [];
        }

        return [(int) $matches[2], (int) $matches[1]];
    }
private static function getSttyColumns ( ) { $ info = static :: runCommand ( 'stty -a | grep columns' ) ; if ( $ info && preg_match ( '/rows.(\d+);.columns.(\d+);/i' , $ info , $ matches ) ) { // extract [w, h] from "rows h; columns w;" } elseif ( $ info && preg_match ( '/;.(\d+).rows;.(\d+).columns/i' , $ info , $ matches ) ) { // extract [w, h] from "; h rows; w columns" } else { return [ ] ; } return [ ( int ) $ matches [ 2 ] , ( int ) $ matches [ 1 ] ] ; }
Run stty command and parse output to width & height.

@return int[]
Run stty command and parse output to width & height .