Forum Moderators: coopster

Message Too Old, No Replies

Getting an arrays values

         

Jacob or JaF

10:01 pm on Sep 6, 2006 (gmt 0)

10+ Year Member



How do I put all the values of an array into another one?

$array['name']='your name'
$array['pass']='your pass'

Now I want to put these values into a new array...

$newarray[0]='your name'
$newarray[1]='your pass'

Something that works like the file() function.

Thanks,
Jacob

eelixduppy

10:14 pm on Sep 6, 2006 (gmt 0)



>>> How do I put all the values of an array into another one?

$one = array("info","info2","info3");
$two = $one;

I'm not sure I quite understand your question. It seems like you have it...

Maybe the Array Documentation [us2.php.net] will help you solve your problem.

Good luck!

Psychopsia

11:07 pm on Sep 6, 2006 (gmt 0)

10+ Year Member



Jacob_or_JaF:

You can do this with the function

array_values()
like:


$array['name'] = 'Your name';
$array['pass'] = 'Your pass';

$new_array = array_values($array);

Hope this helps :)

Jacob or JaF

12:37 am on Sep 7, 2006 (gmt 0)

10+ Year Member



eelixduppy:
I want it to put the old values in the new array starting from 0, not 'name'.

Psychopsia:
That works. Thank you!