|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (9 bit)
Join Date: Jan 2002
Location: UK
Posts: 389
|
PHP Questions
Hi
Well this is what im using to open a test file: $fp = @fopen("data.dat", "rb") or die("Couldn't open file"); while(!feof($fp)) { $data .= fgets($fp, 1024); } fclose($fp); $values = explode("\r\n", $data); Which in other words is taking each line of the data.dat file and assigning: $values[0] with the first line $values[1] with the seccond line $values[2] with the third line and so on for each line in the file, this is all working peechy but say i want to output the seccond line, i would use print (" $values[1] "); which works fine but i want to only output the first 25 words on that line, is there a way to do this Hope someone can help, and hope i've made some sense : ) James |
|
|
|
|
|
#2 |
|
Member (13 bit)
Join Date: Jul 2000
Location: Fullerton, CA
Posts: 7,030
|
Hi James,
Use the string tokenizer function to break the big string up into individual words, then use a loop to display on the first 25. Hope that helps. |
|
|
|
|
|
#3 |
|
Member (9 bit)
Join Date: Jan 2002
Location: UK
Posts: 389
|
ive been working on a better way still
PHP Code:
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|