Results 1 to 1 of 1

Thread: Please help me figuring this out.

  1. #1
    WetCode Guest

    Please help me figuring this out.

    Its been some time since i coded somthing in PHP so i need some help here.

    I want to search a .txt or .rtf file for a line with random numbers.
    I have got some help and came up white this.

    PHP Code:
    <?php
    // the file has been uploaded.
    // (do it yourself)
    $file 'file.rtf';
    // the minimum length of each number
    $min 4;

    $matches = array ();
    foreach (
    file ($file) as $k => $line)
    {
        if (
    preg_match ('/^[\d]{' $min ',}+$/'$line))
        {
            
    $matches[] = $k;
        }
    }

    if (
    sizeof ($matches))
    {
        
    // dumps line numbers with positive match
        
    print_r ($matches);


    ?>
    What this SHOULD do is to basically find the lines in the file with random numbers and it should display the lines that matches. tested and it comes up showing nothing. (Dont know if the code is writen correct.)
    Thanks to all that can shed some lights on this.

    PS: Also i`am sorry if my grammera is not all good. I got some problems with spelling and this is not my native tongue.
    Last edited by Alan; 21 Nov 2010 at 07:34 PM. Reason: Added code tags.

Similar Threads

  1. Help figuring out how to code
    By astima in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 23 Jan 2010, 10:37 PM
  2. I need figuring out cost of a script
    By threedash in forum Job Offers
    Replies: 1
    Last Post: 16 Jan 2010, 09:46 PM

Posting Permissions

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