public function hostname()
    {
        if ($this->host_os === 'WINDOWS') {
            $wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
            $computer = $wmi->ExecQuery("SELECT * FROM Win32_ComputerSystem");

            foreach ($computer as $c) {
                $hostname = $c->Name;
            }
        } else {
            $hostname = shell_exec('hostname');
        }
        return trim($hostname);
    }
public function hostname()
    {
        if ($this->host_os === 'WINDOWS') {
            $wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
            $computer = $wmi->ExecQuery("SELECT * FROM Win32_ComputerSystem");

            foreach ($computer as $c) {
                $hostname = $c->Name;
            }
        } else {
            $hostname = shell_exec('hostname');
        }
        return trim($hostname);
    }
public function hostname ( ) { if ( $ this -> host_os === 'WINDOWS' ) { $ wmi = new \ COM ( "winmgmts:\\\\.\\root\\cimv2" ) ; $ computer = $ wmi -> ExecQuery ( "SELECT * FROM Win32_ComputerSystem" ) ; foreach ( $ computer as $ c ) { $ hostname = $ c -> Name ; } } else { $ hostname = shell_exec ( 'hostname' ) ; } return trim ( $ hostname ) ; }
Get system hostname

@return string
Get system hostname