By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,729 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,729 IT Pros & Developers. It's quick & easy.

arrays: howto convert assoc to numeric

P: n/a

Folks,

If I have a numeric array similar to the following:

$tmpArray[0]="alpha";
$tmpArray[1]="beta";
$tmpArray[2]="charlie";

I can break it down like so

list($first,$second,$third)=$tmpArray;

This would mean $first="alpha", $second="beta" and $third="charlie"

However, when I have an associate array like so

$tmpArray["one"]="alpha";
$tmpArray["two"]="beta";
$tmpArray["three"]="charlie";

and do

list($first,$second,$third)=$tmpArray;

Then $first, $second, $third do not have values - Can someone give me an
environmentally friendly workaround to make this work? I can think of
explodes/implodes and a number of other methods, but I had believed I could
reference the first element in an associate array with a zero... and the
next with a numeric one, but that does not seem to be the case...

all help, via the newsgroup would be much appreciated, thanx

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Randell,

what about using array_values() to convert the array
into a an array with numeric indices?

Greetings from Frankfurt/Germany,

Fabian Wleklinski
Jul 17 '05 #2

P: n/a

"Fabian Wleklinski" <Wl*************@eWorks.de> wrote in message
news:bm********@library1.airnews.net...
Hi Randell,

what about using array_values() to convert the array
into a an array with numeric indices?

Greetings from Frankfurt/Germany,

Fabian Wleklinski

Danke! oder "lovely juvely" von Irish man im Canada.

(Im 1992 Ich habe mine wohn platz im Neuisenberg (oust Frankfurt bei 5km) -
meine deutsche is nicht gut aber ich habe gans gut times im Deutscheland)
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.