protected function getTerminalWidth()
    {
        // from environment
        if (isset($_SERVER['COLUMNS'])) return (int)$_SERVER['COLUMNS'];

        // via tput
        $process = proc_open('tput cols', array(
            1 => array('pipe', 'w'),
            2 => array('pipe', 'w'),
        ), $pipes);
        $width = (int)stream_get_contents($pipes[1]);
        proc_close($process);

        return $width;
    }
protected function getTerminalWidth()
    {
        // from environment
        if (isset($_SERVER['COLUMNS'])) return (int)$_SERVER['COLUMNS'];

        // via tput
        $process = proc_open('tput cols', array(
            1 => array('pipe', 'w'),
            2 => array('pipe', 'w'),
        ), $pipes);
        $width = (int)stream_get_contents($pipes[1]);
        proc_close($process);

        return $width;
    }
protected function getTerminalWidth ( ) { // from environment if ( isset ( $ _SERVER [ 'COLUMNS' ] ) ) return ( int ) $ _SERVER [ 'COLUMNS' ] ; // via tput $ process = proc_open ( 'tput cols' , array ( 1 => array ( 'pipe' , 'w' ) , 2 => array ( 'pipe' , 'w' ) , ) , $ pipes ) ; $ width = ( int ) stream_get_contents ( $ pipes [ 1 ] ) ; proc_close ( $ process ) ; return $ width ; }
Tries to figure out the width of the terminal

@return int terminal width, 0 if unknown
Tries to figure out the width of the terminal