Re: [PHP] parse text file
Benjamin, Use the file() function, it will read a file then return each line as a new element in an array. http://php.net/file - Joe On 7/23/06, Benjamin Adams [EMAIL PROTECTED] wrote: how would I read a file one line at a time: ?php if($lines $alllines){ $newline .= $lines; } ? something like that, I'm cofused on if I use fread, something which will do one line at a time? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse text file
Joe Wollard wrote: Benjamin, Use the file() function, it will read a file then return each line as a new element in an array. http://php.net/file And if file is big (biiig) then you want http://php.net/fgets -- Sameer N. Ingole http://weblogic.noroot.org/ --- Better to light one candle than to curse the darkness. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse text file
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Joe Wollard wrote: Use the file() function, it will read a file then return each line as a new element in an array. http://php.net/file This will not read the file one line at a time. Try http://php.net/fgets. - -Stut On 7/23/06, Benjamin Adams [EMAIL PROTECTED] wrote: how would I read a file one line at a time: ?php if($lines $alllines){ $newline .= $lines; } ? something like that, I'm cofused on if I use fread, something which will do one line at a time? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEw9uX2WdB7L+YMm4RAvR3AJ4rsGP3ZUGBRuoEiv8ilwB9wzyu1wCggOm6 6ctTQ1Xufn0rStHFLcyOFB0= =dGhv -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse text file
Thanks, fgets works great didn't know the function before. On Mon, 2006-07-24 at 01:56 +0530, Sameer N Ingole wrote: Joe Wollard wrote: Benjamin, Use the file() function, it will read a file then return each line as a new element in an array. http://php.net/file And if file is big (biiig) then you want http://php.net/fgets -- Sameer N. Ingole http://weblogic.noroot.org/ --- Better to light one candle than to curse the darkness. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] parse text
You could do it using the substring it you ALWAYS for each line want the characters at that exact location. $moo = 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ; $partition = substr($moo, 9, 5); this would return 5 characters from position 9 in the string which would be: 0ABCD hope this helps... -Original Message- From: sonjaya [mailto:[EMAIL PROTECTED]] Sent: 19 June 2002 8:31 AM To: [EMAIL PROTECTED] Subject: [PHP] parse text i want read some tex like this here contens file text 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ 1. i want read from first left until eight caracter (12345678 -- caracter i cant read ) it can be use fread 2. i want read 5 from nine (9) caracter from left ( 0ABCD --the caracter must i read ) so anybody can help me -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php