gpt4 book ai didi

php - 如何按给定键的值对关联数组进行排序并在 php 中维护键?

转载 作者:搜寻专家 更新时间:2023-10-31 21:26:30 25 4
gpt4 key购买 nike

<分区>

给定这个数组

$inventory = array(
"sdfsdfsdsx65fsdf1"=>array("type"=>"fruit", "price"=>3.50),
"sdfsdfsdsx65fsdf2"=>array("type"=>"milk", "price"=>2.90),
"sdfsdfsdsx65fsdf3"=>array("type"=>"pork", "price"=>5.43)
);

我想要如下输出

$inventory = array(
"sdfsdfsdsx65fsdf3"=>array("type"=>"pork", "price"=>5.43),
"sdfsdfsdsx65fsdf1"=>array("type"=>"fruit", "price"=>3.50),
"sdfsdfsdsx65fsdf2"=>array("type"=>"milk", "price"=>2.90)
);

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com