oops! [was]:Storing key values in an array^%$&

From: Date: Sat, 22 Jan 2005 03:37:37 +0000
Subject: oops! [was]:Storing key values in an array^%$&
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-207025@lists.php.net to get a copy of this message
Dear Todd, to avoid the rants of the likes below in future, please post your actual code ;-) Todd Cary wrote:
Jochem - The problem is the sort()! I did not realize that it replaces the key
just for the sake of history your __complete__ O(*&^&*^$ original post: ========= I am using an array to populate a drop-down and I would like to have the same value in the key as the value. Using the following, the key is 0,1,2,3...etc. How can I correct that?
    $file_list = array();
    $dir = opendir($doc_dir);
    while (false !== ($file = readdir($dir))) {
      if (($file != ".") && ($file != ".."))
        $file_list[$file] = $file;  <---------------<<<<<
    }
Todd http://nl2.php.net/sort

« previous php.general (#207025) next »