RE: [PHP] help!I can't assign values to array ?

From: Date: Thu, 16 Nov 2000 06:06:39 +0000
Subject: RE: [PHP] help!I can't assign values to array ?
Groups: php.general 
Request: Send a blank email to php-general+get-25623@lists.php.net to get a copy of this message
Have you tried: print "Pos 1:". array[1]; Here is an example of using arrays: (its a simple 2 dimensional array nn x 3) Say we have a directory with 1.html 2.html 3.html We want to read that into an array //Declare file_array $file_array =array(); //Throw some stuff from a $file in there $dir_handle = opendir("."); while ($file = readdir($dir_handle)) { $file_array []= array($file,filesize ("$file"),filemtime("$file") ); } File array [pos] [0] will contain the filename File array [pos] [1] will contain the filesize File array [pos] [2] will contain the filedate To iterate through the array $max = sizeof ($file_array); for ($count=0;$count < $max; $count++){ print "POS:$count Filename:" . $file_array [$count][0] . " FileSize: ". $file_array [$count][1] . " FileDate: ". $file_array [$count][2]; } -----Original Message----- From: forestwater [mailto:forestwater@sina.com] Sent: November 16, 2000 01:51 PM To: php-general@lists.php.net Subject: [PHP] help!I can't assign values to array ? I assign values to a array. when I echo the array the result is : "Array[1] Array[2] Array[3] Array[4] Array[5]" But not the values assigned to the array. help !thanks! ______________________________________ =================================================================== ÐÂÀËÃâ·Ñµç×ÓÓÊÏä http://mail.sina.com.cn ÐÂÀËÍÆ³ö°ÂÔ˶ÌÐÅÏ¢ÊÖ»úµã²¥·þÎñ http://sms.sina.com.cn/ -- 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

« previous php.general (#25623) next »