code: public static function getMemInfo()
      {
          $result = [];
          if ($n = preg_match_all('/^([\S]+):\s+(\d+)\skB$/im', file_get_contents('/proc/meminfo'), $matches)) {
              for ($i = 0; $i < $n; $i++) {
                  $result[$matches[1][$i]] = $matches[2][$i];
              }
          }
  
          return $result;
      }
docs: Get information about memory
  
  @return array Get associative array with information about memory. Array key can be:
  <ul>
  <li>MemTotal</li>
  <li>MemFree</li>
  <li>Buffers</li>
  <li>Cached</li>
  <li>SwapCached</li>
  <li>Active</li>
  <li>Inactive</li>
  <li>Active(anon)</li>
  <li>Inactive(anon)</li>
  <li>Active(file)</li>
  <li>Inactive(file)</li>
  <li>Unevictable</li>
  <li>Mlocked</li>
  <li>SwapTotal</li>
  <li>SwapFree</li>
  <li>Dirty</li>
  <li>Writeback</li>
  <li>AnonPages</li>
  <li>Mapped</li>
  <li>Shmem</li>
  <li>Slab</li>
  <li>SReclaimable</li>
  <li>SUnreclaim</li>
  <li>KernelStack</li>
  <li>PageTables</li>
  <li>NFS_Unstable</li>
  <li>Bounce</li>
  <li>WritebackTmp</li>
  <li>CommitLimit</li>
  <li>Committed_AS</li>
  <li>VmallocTotal</li>
  <li>VmallocUsed</li>
  <li>VmallocChunk</li>
  <li>HardwareCorrupted</li>
  <li>AnonHugePages</li>
  <li>Hugepagesize</li>
  <li>DirectMap4k</li>
  <li>DirectMap2M</li>
  </ul>
  @static