print_r("</br>");
print_r($ptidz);
foreach ($techniques as $key => $tech)
{
if (in_array($tech['tech_id'], $ptidz)) {
print_r("</br>");
print_r($tech['tech_id']);
print_r($tech['tech_name']);
}
}
我得到这样的输出:
<br>
Array ( [0] => 48 [1] => 2 [2] => 45 )<br>
2Apple<br>
45lemon<br>
48berry
<br>
但我想根据$ ptidz值确定优先顺序 e.g:
48 berry<br>
2 apple<br>
45 lemon<br>
答案 0 :(得分:0)
然后你需要对数组进行排序以对其进行预处理。
答案 1 :(得分:0)
嗨,请看这个例子,
<?php
$fruits = array("45"=>"lemon", "37"=>"orange", "98"=>"banana", "2"=>"apple");
ksort($fruits);
foreach ($fruits as $key => $val) {
echo "$key = $val\n";
}
?>
以上示例将输出:
2 =苹果37 =橙色45 =柠檬98 =香蕉
这可以帮助你