Answer the question
In order to leave comments, you need to log in
How to swap positions of two elements of an associative array?
array
$arr = [
'a' => 10,
'b' => 20,
'c' => 50, // поменять местами
'd' => 40, // с этим
'e' => 10,
];
'c'
and 'd'
places to get:[
'a' => 10,
'b' => 20,
'd' => 40,
'c' => 50,
'e' => 10,
];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question