ashishrathore Posted January 13, 2006 Share Posted January 13, 2006 hi guys,i had got struc into a deep troubleplz help me outi am taking a line( in form of "s1;s2;s3;s4;s5;" something like that ) from a filecalled db.txtnow i want these s to take into an arrayi do this with the help of EXPLODE functionnw, when i start to print(or pass these values to sm other file) i get my result as Array (ie "Array" is printed) or "Array" is passed to the other filei want to print all those s in the file bt cant get thatplz help me out..for ur convenience i am giving the code that i am using--------------------code---------------------------------------------------------<?php$myarray=file('temp.txt');$h=0;foreach($clines as $c) { $clines=explode(';',$filename); $tmp=$c; $t[$h]=$tmp; $h++; } for($i=0;$i<$h;$i++) echo $l[$i]; ////////////////////// this prints "Array" instead of s's ///////}my text file is something like thissubcat11;subcat12;subcat13;subcat14;------------------------------------------------------------------------- Link to comment Share on other sites More sharing options...
gsmith Posted January 13, 2006 Share Posted January 13, 2006 try using a foreach loop to print as well.foreach($t as $value) echo $value;you also need to define $clines array (should be $clines[]) before the foreach loop that iterates through it. Link to comment Share on other sites More sharing options...
ashishrathore Posted January 16, 2006 Author Share Posted January 16, 2006 thanks it works-ashish Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now