Hướng dẫn dùng interchange keys trong PHP
Ngày đăng:
05/09/2022
Trả lời:
0
Lượt xem:
169
I have an array like
I want to interchange key and value with each other using only for loop, and i want desired output like
asked Oct 17, 2015 at 18:00
Use
If you insist on using a loop, then create a new empty array, iterate through the given array and fill the new array using values as keys, i.e.:
answered Oct 17, 2015 at 18:02
Alex ShesterovAlex Shesterov 24.5k12 gold badges75 silver badges96 bronze badges 2 using a foreach loop:
answered Oct 17, 2015 at 18:17 2 Not the answer you're looking for? Browse other questions tagged php arrays for-loop or ask your own question. |