例如,我们有字符串
$somestring = '11;11;11;12;13';
和数组
$somearray = array(
11 => array(
prop => array(0=>11),
uid => 1,
),
21 => array(
prop => array(0=>12),
uid => 2,
),
32 => array(
prop => array(0=>11),
uid => 1,
),
34 => array(
prop => array(0=>11),
uid => 2,
),
35 => array(
prop => array(0=>13),
uid => 1,
),
36 => array(
prop => array(0=>13),
uid => 3,
),
37 => array(
prop => array(0=>12),
uid => 1,
),
38 => array(
prop => array(0=>12),
uid => 3,
),
39 => array(
prop => array(0=>12),
uid => 1,
),
);
如何在 [prop] 的值等于 $somestring 中的相同值的条件下从 $somearray [uid] 获取并通过填充行输出它,如下所示:
row1:11(uid:1);11(uid:1);11(uid:2);12(uid:2);13(uid:1)
row2:11(uid:);11(uid:);11(uid:);12(uid:1);13(uid:3)
row3:11(uid:);11(uid:);11(uid:);12(uid:3);13(uid:)
row4:11(uid:);11(uid:);11(uid:);12(uid:1);13(uid:)
我在这里找到了一些相关的解决方案http://eval.in/6816但它不处理重复值