note 34461 deleted from function.phpinfo by philip

From: Date: Wed, 06 Apr 2005 03:47:22 +0000
Subject: note 34461 deleted from function.phpinfo by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-87551@lists.php.net to get a copy of this message
Note Submitter: gree dot kmd at wo dot cz ---- simple phpinfo parser and structurer... <?php ob_start(); phpinfo(INFO_MODULES); $string = ob_get_contents(); ob_end_clean(); $pieces = explode("<h2", $string); $settings = array(); foreach($pieces as $val) { preg_match("/<a name=\"module_([^<>]*)\">/", $val, $sub_key); preg_match_all("/<tr[^>]*> <td[^>]*>(.*)<\/td> <td[^>]*>(.*)<\/td>/Ux", $val, $sub); preg_match_all("/<tr[^>]*> <td[^>]*>(.*)<\/td> <td[^>]*>(.*)<\/td> <td[^>]*>(.*)<\/td>/Ux", $val, $sub_ext); foreach($sub[0] as $key => $val) { $settings[$sub_key[1]][strip_tags($sub[1][$key])] = array(strip_tags($sub[2][$key])); } foreach($sub_ext[0] as $key => $val) { $settings[$sub_key[1]][strip_tags($sub_ext[1][$key])] = array(strip_tags($sub_ext[2][$key]), strip_tags($sub_ext[3][$key])); } } echo "<pre>"; print_r($settings); ?>

« previous php.notes (#87551) next »