Text file

Discussion in 'Programming' started by ssimon171078, Jan 5, 2015.

  1. #1
    i have a problem that i receive in output same lines how can i remain one line for example:
    my output :
    https://www.seoclerk.com/Other/2658/Transfer-Funds-to-your-SEOClerks-Account-Balance
    https://www.seoclerk.com/Other/2658/Transfer-Funds-to-your-SEOClerks-Account-Balance
    i need to receive one line
    https://www.seoclerk.com/Other/2658/Transfer-Funds-to-your-SEOClerks-Account-Balance
    i write simple script on php
    i think to use in strpos()
     
    ssimon171078, Jan 5, 2015 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Just do a comparison of the full line?
    
    if ($currentline != $nextline) {
       echo $currentline;
    }
    
    Code (markup):
     
    PoPSiCLe, Jan 5, 2015 IP
  3. 2WDH.com

    2WDH.com Active Member

    Messages:
    143
    Likes Received:
    3
    Best Answers:
    5
    Trophy Points:
    68
    #3
    ssimon171078,
    Do you need to have only unique lines in the whole output or just to avoid duplicate lines that are going in sequence?
     
    2WDH.com, Jan 6, 2015 IP
  4. ssimon171078

    ssimon171078 Well-Known Member

    Messages:
    277
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #4
    i need to avoid duplicate lines that are going in sequence
     
    ssimon171078, Jan 7, 2015 IP
  5. 2WDH.com

    2WDH.com Active Member

    Messages:
    143
    Likes Received:
    3
    Best Answers:
    5
    Trophy Points:
    68
    #5
    Then what PoPSiCLe suggested should work fine. The only thing: probably it will be better to use $previousline instead of $nextline in your case.
     
    2WDH.com, Jan 10, 2015 IP