I wanted a simple *function* to convert the output of phpinfo into an array. Here's what I came up with thanks to alot of the previous authors tips, and the source file: php-5.2.6/ext/standard/info.cCall this function like phpinfo_array() prints the array, phpinfo_array(1) returns the array for your own processing.== Sample Output ==[PHP Configuration] => Array ( [PHP Version] => 5.2.6 [PHP Egg] => PHPE9568F34-D428-11d2-A769-00AA001ACF42 [System] => Linux askapache 2.6.22.19-grsec3 [Build Date] => Nov 11 2008 13:09:07 [Configure Command] => ./configure --prefix=/home/grsec/bin/php [Server API] => FastCGI [IPv6 Support] => enabled [Zend Egg] => PHPE9568F35-D428-11d2-A769-00AA001ACF42 [PHP Credits Egg] => PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000 )[mbstring] => Array ( [mbstring.http_input] => pass [mbstring.internal_encoding] => Array ( [0] => ISO-8859-1 [1] => no value ) [mbstring.language] => neutral )[mcrypt] => Array ( [Version] => 3.5.7 [Api No] => 20031217 )<?phpfunction phpinfo_array($return=false){ ob_start(); phpinfo(-1); $pi = preg_replace( array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms', '#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#', "#[ \t]+#", '# #', '# +#', '# class=".*?"#', '%'%', '#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>' .'<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#', '#<h1><a href="(?:.*?)\?=(.*?)">PHP Credits</a></h1>#', '#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),(?:.*?)</tr>#', "# +#", '#<tr>#', '#</tr>#'), array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ', '<h2>PHP Configuration</h2>'."\n".'<tr><td>PHP Version</td><td>$2</td></tr>'. "\n".'<tr><td>PHP Egg</td><td>$1</td></tr>', '<tr><td>PHP Credits Egg</td><td>$1</td></tr>', '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" . '<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'), ob_get_clean()); $sections = explode('<h2>', strip_tags($pi, '<h2><th><td>')); unset($sections[0]); $pi = array(); foreach($sections as $section){ $n = substr($section, 0, strpos($section, '</h2>')); preg_match_all( '#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#', $section, $askapache, PREG_SET_ORDER); foreach($askapache as $m) $pi[$n][$m[1]]=(!isset($m[3])||$m[2]==$m[3])?$m[2]:array_slice($m,2); } return ($return === false) ? print_r($pi) : $pi;}?>