Thread: Organize Fopen
View Single Post
Re: Organize Fopen
Old
  (#3)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: Organize Fopen - 22-08-2008

hi ancient,

can you show an example of news.txt ?? I don't really understand what the code needs to do.
you want a 2D array? So you should need two loops!?

you need something like this???
PHP Code:

$filename 
"news.txt";
$fp fopen($filename"r");
$contents fread($fpfilesize($filename));
$newsTable explode("|NEWS|"$contents);

$actualNewsTable = array();

for(
$i 0count($newsTable) > $i$i++)
 {
     
$j 0;

     
$str newsTable[$i];

     while ( 
$str explode("|~|"$str) )
          
$actualNewsTable[$i][$j++] = $str;
 }
print_r($actualNewsTable); 

Last edited by Cheeseh; 22-08-2008 at 21:59.. Reason: [php] not [code] !
  
Reply With Quote