Help with Arrays

From: Date: Thu, 27 Feb 2003 21:17:30 +0000
Subject: Help with Arrays
Groups: php.general 
Request: Send a blank email to php-general+get-137471@lists.php.net to get a copy of this message
Hello all I am having some problem with arrays THIS IS THE PHP CODE $temp = file("file.txt"); if(!$temp) {
     echo "File could not be read by array !! <br>";
     exit;
} else echo "Array was opened !!<br><br>"; $x = count($temp); echo "Array Count is: $x<br><br>"; echo "$temp[0]<br>"; //$P = str_replace("\r\n", "\n" , $temp); echo "<br>First: $temp[0]"; $P_new = explode(" ",$temp); echo "<br>Next: $P_new[0]"; THIS IS THE TEXT FILE CALLLED ''file.txt'' abc111 asd123 aqw234 www234 edr234 vfr456 When I echo "$temp[0]" ... I get abc111 asd123 aqw234 www234 edr234 vfr456 on one straight line, which is weird. I should get it on separate lines.. Also I am unable to separate the lines of the file using the explode(). Any help will be highly appreciated --Pushpinder Pushpinder Singh Garcha _________________________________ Web Architect

« previous php.general (#137471) next »