Announcement

Collapse
No announcement yet.

test

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • test

    roobarb roobarb (no custard)
    PHP Code:
    phpinfo();
    phpinfo(INFO_MODULES);

    /** parse php modules from phpinfo */
    function parsePHPModules() {
     
    ob_start();
     
    phpinfo(INFO_MODULES);
     
    $s ob_get_contents();
     
    ob_end_clean();
     
     
    $s strip_tags($s,'<h2><th><td>');
     
    $s preg_replace('/<th[^>]*>([^<]+)<\/th>/',"<info>\\1</info>",$s);
     
    $s preg_replace('/<td[^>]*>([^<]+)<\/td>/',"<info>\\1</info>",$s);
     
    $vTmp preg_split('/(<h2>[^<]+<\/h2>)/',$s,-1,PREG_SPLIT_DELIM_CAPTURE);
     
    $vModules = array();
     for (
    $i=1;$i<count($vTmp);$i++) {
      if (
    preg_match('/<h2>([^<]+)<\/h2>/',$vTmp[$i],$vMat)) {
       
    $vName trim($vMat[1]);
       
    $vTmp2 explode("\n",$vTmp[$i+1]);
       foreach (
    $vTmp2 AS $vOne) {
       
    $vPat '<info>([^<]+)<\/info>';
       
    $vPat3 "/$vPat\s*$vPat\s*$vPat/";
       
    $vPat2 "/$vPat\s*$vPat/";
       if (
    preg_match($vPat3,$vOne,$vMat)) { // 3cols
         
    $vModules[$vName][trim($vMat[1])] = array(trim($vMat[2]),trim($vMat[3])); 
       } elseif (
    preg_match($vPat2,$vOne,$vMat)) { // 2cols
         
    $vModules[$vName][trim($vMat[1])] = trim($vMat[2]); 
       } 
       } 
      } 
     } 
     return 
    $vModules;
    }


    [
    img]http://www.nesa.co.uk/forums/attachment.php?attachmentid=2&d=1157742867
    [/img
    ʎɐqǝ uo pɹɐoqʎǝʞ ɐ ʎnq ı ǝɯıʇ ʇsɐן ǝɥʇ sı sıɥʇ.

    Thought for the day:
    Some people are like slinkies - not really good for anything but bring a smile to your face when thrown down the stairs

    Converting an MFV Fifie trawler type thing.

  • #2
    I know what you mean Mark, it's a pain aint it.
    Last edited by KeithB; 08-09-2006, 10:10 PM. Reason: I just wanted to!!! OK!!!
    Cheers, Keith.

    Comment

    Working...
    X