Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: The Wizard - maaliskuu 11, 2014, 06:49:17 AP

Otsikko: dumb array issue
Kirjoitti: The Wizard - maaliskuu 11, 2014, 06:49:17 AP
This code

$c = array_combine($_POST['image_number'], $_POST['image_name']);

Gets me this array -

Array
(
    [2] => krynoid
    [1] => doctor01
    [3] => doctor02
    [4] => doctor03
    [5] => doctor04
    [6] => doctor05
    [7] => doctor06
    [8] => doctor07
    [9] => doctor08
    [10] => doctor09
)
1

This code
$x = implode(',', $c);

Gets me this array -
krynoid,doctor01,doctor02,doctor03,doctor04,doctor05,doctor06,doctor07,doctor08,doctor091

As you can see from the first array I have switched the first and second items, but in the second array they are put back to their original places.
How do I make the switch show up in the second array.

Thanks

Wiz
Otsikko: Re: dumb array issue
Kirjoitti: margarett - maaliskuu 11, 2014, 06:59:11 AP
ksort ;)
Otsikko: Re: dumb array issue
Kirjoitti: The Wizard - maaliskuu 11, 2014, 07:28:47 AP
It's the little things you forget.

Thank You Margarett