Re: 2D array from file

From: Date: Wed, 26 Sep 2001 23:32:35 +0000
Subject: Re: 2D array from file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-68934@lists.php.net to get a copy of this message
I think this is not working because "\t" is a regular expression and explode only works on strings...... Actually, I have no idea and I feeling very confused right now but maybe try "split" and see how it goes. Brian At 13:37 26/09/2001 -0400, John Frenzel wrote:
I have created a 2D array, then written it into a tet file. The file is written such that all the secondary array elements (the rows) are seperate lines, with the "columns" tab-delimited. Now I'd like to read this file back into a 2D array. I thought this should work: $array_file = file ("array.dat"); for ($k=0; $k <= 63; $k++) {
    $array[$k] = explode( "\t", $array_file[$k] );
} I know that $array[$k] is a valid variable, and that explode returns an array, so I'm not clear why this isn't working. If I use $array = explode( "\t", $array_file[$k] ); I get the line without any trouble. What am I missing? Thanks --- John Frenzel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
------------------------- Brian White Step Two Designs Pty Ltd - SGML, XML & HTML Consultancy Phone: +612-93197901 Web: http://www.steptwo.com.au/ Email: bwhite@steptwo.com.au

« previous php.general (#68934) next »