title: Get total available system memory with PHP on Windows
body: <p>Using PHP, I'd like to get the total memory available to the system (not just the free or used memory).</p>
  
  <p>On Linux it's quite straight forward. You can do:</p>
  
  <p><code>$memory = fopen('/proc/meminfo');</code></p>
  
  <p>and then parse the file.</p>
  
  <p>Is anyone aware of an equivalent method for Windows? I'm open to any suggestions.</p>
  
  <p><strong>Edit: We have a solution (but StackOverflow won't let me answer my own question):</strong></p>
  
  <pre><code>exec( 'systeminfo', $output );
  
  foreach ( $output as $value ) {
      if ( preg_match( '|Total Physical Memory\:([^$]+)|', $value, $m ) ) {
          $memory = trim( $m[1] );
  }
  </code></pre>
  
  <p>Not the most elegant solution, and it's very slow, but it suits my need.</p>