Results 1 to 4 of 4

Thread: Reading text string from text file (PHP)

  1. #1
    Join Date
    May 2008
    Posts
    29

    Reading text string from text file (PHP)

    I have a text file where I can load the data well in an array, but now I have to change that on the same line. It is the following:
    "printer name, ip address" ... And it must be captured and then print them in a the second file. How do I load the two strands of each variable in php?

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Reading text string from text file (PHP)

    $ array = explode (";", $ string);
    print_r ($ array)//show you array'et.
    echo "Printer Name:". $ array [0]. "<br />\n";
    echo "IP:". $ array [1]. "<br /> \ n";

  3. #3
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Reading text string from text file (PHP)

    $text="printername,ipaddress";
    list($ pnavn,$ipaddress)=explode (';',$ text);

  4. #4
    Join Date
    May 2008
    Posts
    29

    Re: Reading text string from text file (PHP)

    Thank you for your help There were several useful strings.

Similar Threads

  1. Reading a text file divided by tab
    By Cooper Sheldon in forum Software Development
    Replies: 4
    Last Post: 08-09-2012, 04:08 PM
  2. Reading text file in VC++ display it in textbox
    By molocas in forum Software Development
    Replies: 1
    Last Post: 26-07-2010, 10:34 AM
  3. Problem reading a text file
    By Vodka in forum Software Development
    Replies: 5
    Last Post: 26-02-2010, 04:02 AM
  4. How to read string from a given text file using C# program?
    By Kasper in forum Software Development
    Replies: 5
    Last Post: 25-02-2010, 10:18 PM
  5. Replace text string using batch file
    By jean-paul martell in forum Operating Systems
    Replies: 2
    Last Post: 23-06-2009, 01:18 PM

Tags for this Thread

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
  •  
Page generated in 1,714,041,082.33991 seconds with 17 queries