Switch two items in associative array

后端 未结 17 1904
自闭症患者
自闭症患者 2021-02-05 12:53

Example:

$arr = array(
  \'apple\'      => \'sweet\',
  \'grapefruit\' => \'bitter\',
  \'pear\'       => \'tasty\',
  \'banana\'     => \'yellow\'
)         


        
17条回答
  •  南笙
    南笙 (楼主)
    2021-02-05 13:07

    There is no easy way, just a loop or a new array definition.

提交回复
热议问题