1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Php script

Discussion in 'PHP' started by ssimon171078, Jan 8, 2023.

  1. #1
    i have text :
    You, +1 (212) 202-8668, +1 (251) 480-2453, +1 (365) 360-0641, +1 (365) 400-5094
    i need to receive
    +1 (212) 202-8668
    +1 (251) 480-2453,
    +1 (365) 360-0641
    i started to write php code how to change this code to receive this result ?
    <?php

    $filename="r1.txt";
    $fd=fopen($filename,"r");

    $fp = fopen($filename, "r");

    if(filesize($filename) > 0){
    $content = fread($fp, filesize($filename));
    echo $content ."\n";
    echo "\r";
    fclose($fp);
    }




    ?>
     
    ssimon171078, Jan 8, 2023 IP
  2. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #2
    Wouldn't it be easier to just do this?

    
    <?php
    $filename = file_get_contents("r1.txt");
    $myArray = explode(',', $filename);
    foreach($myArray as $result) {
        echo $result ."<br>";
    }
    ?>
    
    Code (markup):
     
    qwikad.com, Jan 8, 2023 IP
    Vooler likes this.
  3. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #3
    qwikad.com - perfect

    
    print implode("\n", explode(",", str_replace(', ', ',', $content )));
    
    Code (markup):
     
    Vooler, Jan 9, 2023 IP
    qwikad.com likes this.