Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 16-01-2009
Member
 
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?
Reply With Quote
  #2  
Old 16-01-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
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";
Reply With Quote
  #3  
Old 16-01-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: Reading text string from text file (PHP)

$text="printername,ipaddress";
list($ pnavn,$ipaddress)=explode (';',$ text);
Reply With Quote
  #4  
Old 16-01-2009
Member
 
Join Date: May 2008
Posts: 29
Re: Reading text string from text file (PHP)

Thank you for your help There were several useful strings.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 08:49 PM.