I don't believe there is a way with file(), but there are alternatives.

Firstly, does it need to be in an array? Does your script do anything else with $lineArray? If not, you'd be much better off just using file_get_contents() (http://php.net/file_get_contents) or, if you just want to output the file, readfile() (http://php.net/readfile), which dumps the file contents straight out to the visitor.

If you do need to get it into an array, fgets() should work. Here's an example on the site (http://php.net/fgets), butchered to suit:

$lineArray = array();
$handle = @fopen("/tmp/inputfile.txt", "r");
if ($handle) {
   while (!feof($handle)) {
       $lineArray[] = fgets($handle, 4096);

That will get up to 4096 characters per line, and I'm sure increasing this isn't too complex :)


Ron Piggott wrote:
This is a sample of code which takes the $web_page and puts it into

The problem I have is that I have lines in my $web_page files which are
longer (have more characters) than $message is able to handle and chunks
of web page text are simply truncated after the character limit has been
reached.  Is there a way to deal with this and allow $message (for
example) to hold 500 or 1,000 characters --- twice of whatever the
default setting is?


$lineArray = file($web_page);

// make an empty variable first
$message =  "";

// concat all array element
foreach($lineArray as $eachLine) {
$message .= $eachLine;

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to