These two lines will produce the error "Strict Standards: Only variables should be passed by reference in...". The root of the error is in the incorrect use of the end() function. The code works but thows the said error.To address this try using the following statements:

if(! empty($phpinfo)){ foreach($phpinfo as $name => $section) { echo "<h3>$name</h3>\n<table class='wp-list-table widefat fixed pages'>\n"; foreach($section as $key => $val){ if(is_array($val)){ echo "<tr><td>$key</td><td>$val[0]</td><td>$val[1]</td></tr>\n"; }elseif(is_string($key)){ echo "<tr><td>$key</td><td>$val</td></tr>\n"; }else{ echo "<tr><td>$val</td></tr>\n"; } } } echo "</table>\n"; }else{ echo "<h3>Sorry, the phpinfo() function is not accessable. Perhaps, it is disabled<a href='http://php.net/manual/en/function.phpinfo.php'>See the documentation.</a></h3>"; }}?>Frankly, I went thought the trouble of adding this note because the example by "jon at sitewizard dot ca" is probably the best on the web, and thought it unfortunate that it throws errors. Hope this is useful to someone.

some fixes to correct result displaying:1. we need to trim $matches [1], 'cause there can be empty lines;2. not bad to remove <body> tag 'cause styles for it not apply correctly...3. ...and change styles a little (remove "body" selector)

I needed a way to quickly scroll through the phpinfo which is a large list of information. so here it is. In the top there is a list with sections, the new section loaded extensions will hold the links to the anchors of the loaded modules. the section session variables will show the current loaded sessions. It's using Domdocument for manipulation so you should have that loaded:<?phpob_start();$exts = get_loaded_extensions();phpinfo();$phpinfo = ob_get_contents();ob_end_clean();//print $phpinfo;$html_str = $phpinfo;$html = new DOMDocument();$html->loadHTML($html_str);$title = $html->getElementsByTagName("title")->item(0);$title->nodeValue = "PHP Version ".phpversion();$body = $html->getElementsByTagName("body")->item(0);

This is a slight modification to the previous code by "code at adspeed dot com" that extracts the PHP modules as an array. I used it on PHP 4.1.2 and it failed as the <h2> tags also had an align="center". So this update changes the regex for those tags:

Note: In order to properly retrieve all of the data, the regular expression matches table headers as well as table data, resulting in 'Local Value' and 'Global Value' showing up as 'Directive' entries.

One note on the above functions for cleaning up the phpinfo() HTML and throwing it into an array data structure. In order to catch all of the info tidbits the preg_match_all has to be tweaked to deal with 2 and 3 column tables.

I have changed the preg_match_all() here so that the last <td></td> is optional

here you can notice that these numeric values of phpinfoare similar to certain things in the binary system:

-1, coded in 7 digits:111 1111

look at this:1+2+4+8+16+32+64=127

unsigned,127 is:111 1111

so, take a look at this: the way to get all function is to add all of them. zero is nothing.-1 is all.so you can pass option with a negative number.for example:<?php phpinfo(48) ?>is also:<?php phpinfo(-80) ?>48 = 32 + 16-80= 0 - 64 - 8 - 4 - 2 - 1

so you can see in negative mode it like that:not nothingnot all (-1) don't forget it !not option 64not option 8not option 4not option 2

so, that's good if you don't want option 8, you will do this:not nothing(0)not all(-1)not option 8(-1)you got:<?php phpinfo(-9); ?>

This is necessary to obtain a W3C validation (XHTML1.0 Transitionnal)...phpinfo's output is declared with that DTD :- "System ID" has the wrong url to validate : "DTD/xhtml1-transitional.dtd" rather than "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"- Some module names contains space and the function's output use the name in anchors as ID and NAME. these attributes can't be validated like that (unique name only).

// Now you get a clean output and you are able to validate.../*echo ($doc->saveXML ());// ORecho ($doc->saveHTML ()); */

// By that way it's easy to add some style declaration :$style = $doc->getElementsByTagName ('style')->item (0);$style->appendChild ($doc->createTextNode ('/* SOME NEW CSS RULES TO ADD TO THE FUNCTION OUTPUT */'));