On Fri, Jun 21, 2002 at 11:03:30AM +0700, sonjaya wrote:
> I have capture serial port (pabx phone) ,and get the file dat like in
> attachement.
> 17/06/02 07:27:30 08 00:00:59 437 2034224
> ... snip ...
> I want make screen lay out like this
> 17/06/02 437 2034224 00:00:59 Local 500
Take a look at fopen(), fgets() and preg_split() in the manual.
Open the file with fopen() then put fgets() in a while loop to go through
the file one line at a time, passing each line to the split.
For the split, use '/\s+/' as the "string pattern" That will produce an
array from which you can display the data in any way you want.
Aw, heck, something like this untested tidbit...
$File = fopen('./filename.txt', 'r');
while ( $Data = preg_split('/\s+/', fgets($File)) ) {
echo "$Data[0]\t$Data[5] ... etc ...\n";
}
Enjoy,
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php