public function memory_total()
    {
        $mem_total = 0;
        if ($this->host_os === 'WINDOWS') {
            $wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
            $os =  $wmi->ExecQuery("SELECT * FROM Win32_OperatingSystem");

            foreach ($os as $m) {
                $mem_total = $m->TotalVisibleMemorySize;
            }
        } else {
            $fh = fopen('/proc/meminfo', 'r');

            while ($line = fgets($fh)) {
                $pieces = array();
                if (preg_match('/^MemTotal:\s+(\d+)\skB$/', trim($line), $pieces)) {
                    $mem_total = $pieces[1];
                    break;
                }
            }
            fclose($fh);
        }
        return $mem_total;
    }
public function memory_total()
    {
        $mem_total = 0;
        if ($this->host_os === 'WINDOWS') {
            $wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
            $os =  $wmi->ExecQuery("SELECT * FROM Win32_OperatingSystem");

            foreach ($os as $m) {
                $mem_total = $m->TotalVisibleMemorySize;
            }
        } else {
            $fh = fopen('/proc/meminfo', 'r');

            while ($line = fgets($fh)) {
                $pieces = array();
                if (preg_match('/^MemTotal:\s+(\d+)\skB$/', trim($line), $pieces)) {
                    $mem_total = $pieces[1];
                    break;
                }
            }
            fclose($fh);
        }
        return $mem_total;
    }
public function memory_total ( ) { $ mem_total = 0 ; if ( $ this -> host_os === 'WINDOWS' ) { $ wmi = new \ COM ( "winmgmts:\\\\.\\root\\cimv2" ) ; $ os = $ wmi -> ExecQuery ( "SELECT * FROM Win32_OperatingSystem" ) ; foreach ( $ os as $ m ) { $ mem_total = $ m -> TotalVisibleMemorySize ; } } else { $ fh = fopen ( '/proc/meminfo' , 'r' ) ; while ( $ line = fgets ( $ fh ) ) { $ pieces = array ( ) ; if ( preg_match ( '/^MemTotal:\s+(\d+)\skB$/' , trim ( $ line ) , $ pieces ) ) { $ mem_total = $ pieces [ 1 ] ; break ; } } fclose ( $ fh ) ; } return $ mem_total ; }
Get memory total kB

@return int
Get memory total kB