max array size question..

From: Date: Mon, 05 Mar 2001 04:24:25 +0000
Subject: max array size question..
Groups: php.general 
Request: Send a blank email to php-general+get-42571@lists.php.net to get a copy of this message
I'm trying to read in a text file that has 42620 lines. Each line has zip code information separated by commas. I have no problem reading the file into an array. But when I try and read each element in the array and put it into another array I get a "500 server error". The second to last line is what's causing the problem. After doing some debugging I found out that at around iteration 18000 is when the server error occurs. Any ideas? I know I should use a database, but i'm intrigued by this problem. Here's the code that does the work... # read the file in, each line in the file is it's own element in the array $lineArray = file( "zips.txt" ); # initialize variable, showing that there's nothing in $ZIPS $ZIPS = array(); # iterate through each element in the array, foreach() is probably cleaner for($i = 0; $i < count($lineArray); $i++ ) { # set variable $value = $lineArray[ $i ]; # set $tempArray to a new array $tempArray = array(); # convert the line into an array $tempArray = explode( ",", $value ); # add the line to the array in the format # $ZIPS[ "zip code" ] = array( "zip code", "state", "city", "lat", "long" ) $ZIPS[ $tempArray[ 0 ] ] = $tempArray; } Thanks in advance. Jeff

« previous php.general (#42571) next »