Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts

    help with Regular Expressions

    i am trying to build a system using a config file

    but i'm not sure on how to read the files
    PHP Code:
    function read_pram($pram$fail null){ // read saved settings - for child instance to load settings
            
    $fh fopen('deamon.ini''r');
            
    $buf '';
            while(!
    feof($fh)){// at end of file?
                
    $buf .= fread($fh512); // read till end of file
            
    }// end of file reached
            
    fclose($fh);
            
    $result preg_match("[".$pram."]=(.*?)\n"$buf);
            if(
    $result == 'NULL'){// result not returned?
                
    return $fail;
            }
    // result was returned
            
    return $result;
        }
    //end read 
    Im not sure about this line
    $result = preg_match("[".$pram."]=(.*?)\n", $buf);

    is it preg_match the right way if not can some one show me please
    Last edited by barkermn01; 03-10-2009 at 11:51 PM.
    Working towards a Internet where we don't have website just browser applications Kill the Hyper-link and say hello to 3D Games in the browser :)

  • #2
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •