我想根据 php 中搜索字符串的出现对二维数组进行排序。我试图根据搜索字符串的相关性来获取数据。我遇到了比赛和反对,但它可以在MYISAM上工作,但我的桌子在innodb中。所以计划使用任何排序函数对数组进行排序,但我什么也找不到。
我的搜索压力测试字符串数组
Array
(
[0] => pressure
[1] => tes
)
我的输出数组匹配上面的字符串和标题是
Array
(
[0] => Array
(
[title] => tests.doc
[link] => http://localhost/test.doc
[snippet] =>
)
[1] => Array
(
[title] => Pressure Testing Your Company
[link] => http://localhost/Pressure_Testing_Your_Companys.pdf
[snippet] => Questions used by the CFO against dimensions critical to success
)
[2] => Array
(
[title] => pressure.doc
[link] => http://localhost/pressure.doc
[snippet] => Templates for services
)
)
在上面的数组中,最相关的 array[1] 然后是 array[2] 然后是 array[0] 应该是这个顺序。我想相应地对这个数组进行排序。我的输出应该如下所示:
Array
(
[0] => Array
(
[title] => Pressure Testing Your Company
[link] => http://localhost/Pressure_Testing_Your_Companys.pdf
[snippet] => Questions used by the CFO against dimensions critical to success
)
[1] => Array
(
[title] => pressure.doc
[link] => http://localhost/pressure.doc
[snippet] => Templates for services
)
[2] => Array
(
[title] => tests.doc
[link] => http://localhost/test.doc
[snippet] =>
)
)
请帮我!!!!