Connecting Tech Pros Worldwide Help | Site Map

arrays: howto convert assoc to numeric

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 12:31 AM
Randell D.
Guest
 
Posts: n/a
Default arrays: howto convert assoc to numeric


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?



  #2  
Old July 17th, 2005, 12:32 AM
Fabian Wleklinski
Guest
 
Posts: n/a
Default Re: arrays: howto convert assoc to numeric

Hi Randell,

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

Greetings from Frankfurt/Germany,

Fabian Wleklinski


  #3  
Old July 17th, 2005, 12:32 AM
Randell D.
Guest
 
Posts: n/a
Default Re: arrays: howto convert assoc to numeric


"Fabian Wleklinski" <Wleklinski.NNTP@eWorks.de> wrote in message
news:bmgcv3$c60@library1.airnews.net...[color=blue]
> Hi Randell,
>
> what about using array_values() to convert the array
> into a an array with numeric indices?
>
> Greetings from Frankfurt/Germany,
>
> Fabian Wleklinski
>
>[/color]
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)


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.