Re: Associative arrays (names and strings)

From: Date: Thu, 30 Aug 2001 14:31:36 +0000
Subject: Re: Associative arrays (names and strings)
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-65277@lists.php.net to get a copy of this message
Thanks again! "Andrey Hristov" <ahristov@icygen.com> wrote in message news:030201c1314e$0cc2aee0$0b01a8c0@ANDreY... > The return value of mysql_fetch_array is something strange. You receive into the array data copied to times. 0 is no alias to 'name' > for example. If you want this behaviour do that: > $arr=array_merge_recursive($arr,array_values($arr)); > now do what you want to do > > Andrey Hristov > IcyGEN Corporation > http://www.icygen.com > 99% > > ----- Original Message ----- > From: "_lallous" <elias_bachaalany@yahoo.com> > To: <php-general@lists.php.net> > Sent: Thursday, August 30, 2001 4:10 PM > Subject: Re: [PHP] Associative arrays (names and strings) > > > > not what I want! > > i want something like this when you do mysql_fetch_array() don't you get a > > reference to your columuns via fieldname or array index? > > > > ie. $row = mysql_fetch_array($result_set); > > echo $row['name']; > > or > > echo $row[0]; > > > > same return same value! I want something like it with my initial post. > > > > "Andrey Hristov" <andy@anderseen.com> wrote in message > > news:027101c13145$a7e2af00$0b01a8c0@ANDreY... > > > <?php > > > $arr = array("set1" => array(1, 2, 3, 4), "set2" => > > > array(11, 22, 33, > > 44), > > > "set3" => array(111, 222, 333, 444)); > > > $a=array_keys($arr); > > > var_dump($a); > > > // var_dump(array_keys($arr)["set1"]); not possible > > > > > > ?> > > > > > > Andrey Hristov > > > IcyGEN Corporation > > > http://www.icygen.com > > > 99% > > > > > > > > > ----- Original Message ----- > > > From: "_lallous" <elias_bachaalany@yahoo.com> > > > To: <php-general@lists.php.net> > > > Sent: Thursday, August 30, 2001 3:00 PM > > > Subject: [PHP] Associative arrays (names and strings) > > > > > > > > > > Anyway to do this fast: > > > > > > > > $arr = array("set1" => array(1, 2, 3, 4), "set2" => > > > > array(11, 22, 33, > > 44), > > > > "set3" => array(111, 222, 333, 444)); > > > > > > > > It's not that I want to access $arr like: echo $arr['set1'] > > > > I also want to access it as: echo $arr[1] (and it must be equal to > > > > $arr['set1']; > > > > > > > > and It seems i can't do this: > > > > $arr = array("set1", 1 => array(1, 2, 3, 4), "set2", 2 > > > > => array(11, 22, > > 33, > > > > 44), "set3", 3 => array(111, 222, 333, 444)); > > > > > > > > any suggestion to get an array associated by both number and string > > keys? > > > > > > > > > > > > > > > > -- > > > > 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 > > > > > > > > > > > > > > > > > > > -- > > 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 (#65277) next »