Results 1 to 3 of 3

Thread: line read

  1. #1
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs down line read

    hi,

    i need a php code that reads the first line of a file "test.txt".
    and checks if it is equal to ="hello".
    can any body help!

  2. #2
    Join Date
    Feb 2008
    Posts
    81
    Thanks
    8
    Thanked 5 Times in 5 Posts

    Default

    This code can be used!


    <?php

    $lns = file('test.txt');
    $ln = count($lns);
    for($x = 0; $x< $ln; $x++)
    {
    }

    if($lns[0]=='hello')
    {
    echo "correct";
    }

    else
    {
    echo "wrong";
    }


    ?>







    ?>

  3. #3
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hey awsome is working!

    Thanks alot!

Bookmarks

Posting Permissions

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