我有一个像这样的数组:
[
['number' => '419-1'],
['number' => '302-1'],
['number' => '102-1'],
['number' => '102-11'],
['number' => '203-1'],
['number' => '508-1'],
['number' => '105-1'],
['number' => '102-2'],
['number' => '302-2'],
]
我想要这样的输出:
[
['number' => '102-1'],
['number' => '102-2'],
['number' => '102-11'],
['number' => '105-1'],
['number' => '203-1'],
['number' => '302-1'],
['number' => '302-2'],
['number' => '419-1'],
['number' => '508-1']
]
问题是数字存储为字符串。我想将数字视为整数。排序需要按数字进行。没有字符串比较。我尝试过usort,但这没有帮助。
有人可以帮帮我吗?
芜湖不芜