tags:

views:

47

answers:

2

What would be a good way of fliping key 1 with key 2?

// original
Array
(
    [0] => Text1
    [1] => World
    [2] => Hello
)

// after

Array
(
    [0] => Text1
    [1] => Hello
    [2] => World
)

Any clues. Thanks

+4  A: 

If it's a simple as that,

$tmp = $array[1];
$array[1] = $array[2];
$array[2] = $tmp;
David Caunt
A: 
$A = array("Text1", "Hello", "World");
$tmp = $A[2];
$A[2] = $A[1];
$A[1] = $tmp;
Legion