2012-04-12 15 views
0

にラベルを付けながら:私は、同様の組み合わせのすべての組み合わせを必要とする警告とデカルト積を取得する必要がありPHPデカルトプロダクトキーを組み合わせると、私は、次の2つのアレイ持っ

<?php 
    $a = array(// actions 
    'left' => 'LEFT', 
    'middle' => 'MIDDLE', 
    'right' => 'RIGHT', 
); 
    $m = array(// modifiers 
    'ctrl' => 'CTRL', 
    'alt' => 'ALT', 
    'shift' => 'SHIFT', 
    'double' => 'DOUBLE', 
); 
?> 

を。もちろん、配列にもっと多くのオプションを追加する必要があります。だから、生成されたリストを出力すべき次のように:

<?php 
$options['left'] = 'LEFT'; 
$options['LEFT'] = array(
    'ctrl_left' => 'CTRL+LEFT', 
    'alt_left' => 'ALT+LEFT', 
    'shift_left' => 'SHIFT+LEFT', 
    'double_left' => 'DOUBLE+LEFT', 
    'ctrl_alt_left' => 'CTRL+ALT+LEFT', 
    'ctrl_shift_left' => 'CTRL+SHIFT+LEFT', 
    'ctrl_double_left' => 'CTRL+DOUBLE+LEFT', 
    'alt_shift_left' => 'ALT+SHIFT+LEFT', 
    'alt_double_left' => 'ALT+DOUBLE+LEFT', 
    'ctrl_alt_shift_left' => 'CTRL+ALT+SHIFT+LEFT', 
    'ctrl_alt_double_left' => 'CTRL+ALT+DOUBLE+LEFT', 
    'ctrl_alt_shift_double_left' => 'CTRL+ALT+SHIFT+DOUBLE+LEFT', 
); 
$options['middle'] = 'MIDDLE'; 
$options['MIDDLE'] = array(
    'ctrl_middle' => 'CTRL+MIDDLE', 
    'alt_middle' => 'ALT+MIDDLE', 
    'shift_middle' => 'SHIFT+MIDDLE', 
    'double_middle' => 'DOUBLE+MIDDLE', 
    'ctrl_alt_middle' => 'CTRL+ALT+MIDDLE', 
    'ctrl_shift_middle' => 'CTRL+SHIFT+MIDDLE', 
    'ctrl_double_middle' => 'CTRL+DOUBLE+MIDDLE', 
    'alt_shift_middle' => 'ALT+SHIFT+MIDDLE', 
    'alt_double_middle' => 'ALT+DOUBLE+MIDDLE', 
    'ctrl_alt_shift_middle' => 'CTRL+ALT+SHIFT+MIDDLE', 
    'ctrl_alt_double_middle' => 'CTRL+ALT+DOUBLE+MIDDLE', 
    'ctrl_alt_shift_double_middle' => 'CTRL+ALT+SHIFT+DOUBLE+MIDDLE', 
); 

$options['right'] = 'RIGHT'; 
$options['RIGHT'] = array(
    'ctrl_right' => 'CTRL+RIGHT', 
    'alt_right' => 'ALT+RIGHT', 
    'shift_right' => 'SHIFT+RIGHT', 
    'double_right' => 'DOUBLE+RIGHT', 
    'ctrl_alt_right' => 'CTRL+ALT+RIGHT', 
    'ctrl_shift_right' => 'CTRL+SHIFT+RIGHT', 
    'ctrl_double_right' => 'CTRL+DOUBLE+RIGHT', 
    'alt_shift_right' => 'ALT+SHIFT+RIGHT', 
    'alt_double_right' => 'ALT+DOUBLE+RIGHT', 
    'ctrl_alt_shift_right' => 'CTRL+ALT+SHIFT+RIGHT', 
    'ctrl_alt_double_right' => 'CTRL+ALT+DOUBLE+RIGHT', 
    'ctrl_alt_shift_double_right' => 'CTRL+ALT+SHIFT+DOUBLE+RIGHT', 
); 
?> 
+0

http://stackoverflow.com/questions/6311779/finding-cartesian-product-with-php-associative-arrays – Jonathan

+0

リンクされた回答がこれで機能することをお勧めしますか?尋ねられる質問は、私が理解できるものと同じ要件を持っていないようです。 –

+0

それはおそらくあなたが何をする必要があるかにあなたを手がかりになるだろう。あなたの質問名と他の質問は非常に似ています。 – Jonathan

答えて

0

私はそれを理解し終わった。 strpos()の私のテストと私の爆発( '_ ......)は完全に満足していませんが、それは動作し、私が必要とするものを行います。

http://ideone.com/1WDOp

<?php 
function custombuttons_generate_children(&$options, $a, $m, $k) { 
    $mcount = count($m); 
    if (empty($options[$a[$k]])) { 
    foreach ($m as $key => $label) { 
     $new_key = implode('_', array($k, $key)); 
     $new_label = implode('+', array($label, $a[$k])); 
     $options[$a[$k]][$new_key] = $new_label; 
    } 
    } 
    else { 
    foreach ($options[$a[$k]] as $key => $label) { 
     foreach ($m as $mkey => $mlabel) { 
     if (!strpos($key, '_' . $mkey)) { 
      $new_key = implode('_', array($key, $mkey)); 
      $new_label = implode('+', array($mlabel, $label)); 
      $options[$a[$k]][$new_key] = $new_label; 
     } 
     } 
    } 
    } 
    $last = end(array_keys($options[$a[$k]])); 
    if (count(explode('_', $last)) !== $mcount) { 
    custombuttons_generate_children($options, $a, $m, $k); 
    } 
} 

function custombuttons_action_options_list() { 
    $a = array(
    'left' => 'LEFT', 
    'middle' => 'MIDDLE', 
    'right' => 'RIGHT', 
); 
    $m = array(// modifiers 
    'ctrl' => 'CTRL', 
    'alt' => 'ALT', 
    'shift' => 'SHIFT', 
    'double' => 'DOUBLE', 
); 
    foreach ($a as $key => $label) { 
    $options[$key] = $label; 
    $options[$label] = array(); 
    custombuttons_generate_children($options, $a, $m, $key); 
    } 
    return $options; 
} 
$options = custombuttons_action_options_list(); 
?> 

出力:

Array 
(
    [left] => LEFT 
    [LEFT] => Array 
     (
      [left_ctrl] => CTRL+LEFT 
      [left_alt] => ALT+LEFT 
      [left_shift] => SHIFT+LEFT 
      [left_double] => DOUBLE+LEFT 
      [left_ctrl_alt] => ALT+CTRL+LEFT 
      [left_ctrl_shift] => SHIFT+CTRL+LEFT 
      [left_ctrl_double] => DOUBLE+CTRL+LEFT 
      [left_alt_ctrl] => CTRL+ALT+LEFT 
      [left_alt_shift] => SHIFT+ALT+LEFT 
      [left_alt_double] => DOUBLE+ALT+LEFT 
      [left_shift_ctrl] => CTRL+SHIFT+LEFT 
      [left_shift_alt] => ALT+SHIFT+LEFT 
      [left_shift_double] => DOUBLE+SHIFT+LEFT 
      [left_double_ctrl] => CTRL+DOUBLE+LEFT 
      [left_double_alt] => ALT+DOUBLE+LEFT 
      [left_double_shift] => SHIFT+DOUBLE+LEFT 
      [left_ctrl_alt_shift] => SHIFT+ALT+CTRL+LEFT 
      [left_ctrl_alt_double] => DOUBLE+ALT+CTRL+LEFT 
      [left_ctrl_shift_alt] => ALT+SHIFT+CTRL+LEFT 
      [left_ctrl_shift_double] => DOUBLE+SHIFT+CTRL+LEFT 
      [left_ctrl_double_alt] => ALT+DOUBLE+CTRL+LEFT 
      [left_ctrl_double_shift] => SHIFT+DOUBLE+CTRL+LEFT 
      [left_alt_ctrl_shift] => SHIFT+CTRL+ALT+LEFT 
      [left_alt_ctrl_double] => DOUBLE+CTRL+ALT+LEFT 
      [left_alt_shift_ctrl] => CTRL+SHIFT+ALT+LEFT 
      [left_alt_shift_double] => DOUBLE+SHIFT+ALT+LEFT 
      [left_alt_double_ctrl] => CTRL+DOUBLE+ALT+LEFT 
      [left_alt_double_shift] => SHIFT+DOUBLE+ALT+LEFT 
      [left_shift_ctrl_alt] => ALT+CTRL+SHIFT+LEFT 
      [left_shift_ctrl_double] => DOUBLE+CTRL+SHIFT+LEFT 
      [left_shift_alt_ctrl] => CTRL+ALT+SHIFT+LEFT 
      [left_shift_alt_double] => DOUBLE+ALT+SHIFT+LEFT 
      [left_shift_double_ctrl] => CTRL+DOUBLE+SHIFT+LEFT 
      [left_shift_double_alt] => ALT+DOUBLE+SHIFT+LEFT 
      [left_double_ctrl_alt] => ALT+CTRL+DOUBLE+LEFT 
      [left_double_ctrl_shift] => SHIFT+CTRL+DOUBLE+LEFT 
      [left_double_alt_ctrl] => CTRL+ALT+DOUBLE+LEFT 
      [left_double_alt_shift] => SHIFT+ALT+DOUBLE+LEFT 
      [left_double_shift_ctrl] => CTRL+SHIFT+DOUBLE+LEFT 
      [left_double_shift_alt] => ALT+SHIFT+DOUBLE+LEFT 
     ) 

    [middle] => MIDDLE 
    [MIDDLE] => Array 
     (
      [middle_ctrl] => CTRL+MIDDLE 
      [middle_alt] => ALT+MIDDLE 
      [middle_shift] => SHIFT+MIDDLE 
      [middle_double] => DOUBLE+MIDDLE 
      [middle_ctrl_alt] => ALT+CTRL+MIDDLE 
      [middle_ctrl_shift] => SHIFT+CTRL+MIDDLE 
      [middle_ctrl_double] => DOUBLE+CTRL+MIDDLE 
      [middle_alt_ctrl] => CTRL+ALT+MIDDLE 
      [middle_alt_shift] => SHIFT+ALT+MIDDLE 
      [middle_alt_double] => DOUBLE+ALT+MIDDLE 
      [middle_shift_ctrl] => CTRL+SHIFT+MIDDLE 
      [middle_shift_alt] => ALT+SHIFT+MIDDLE 
      [middle_shift_double] => DOUBLE+SHIFT+MIDDLE 
      [middle_double_ctrl] => CTRL+DOUBLE+MIDDLE 
      [middle_double_alt] => ALT+DOUBLE+MIDDLE 
      [middle_double_shift] => SHIFT+DOUBLE+MIDDLE 
      [middle_ctrl_alt_shift] => SHIFT+ALT+CTRL+MIDDLE 
      [middle_ctrl_alt_double] => DOUBLE+ALT+CTRL+MIDDLE 
      [middle_ctrl_shift_alt] => ALT+SHIFT+CTRL+MIDDLE 
      [middle_ctrl_shift_double] => DOUBLE+SHIFT+CTRL+MIDDLE 
      [middle_ctrl_double_alt] => ALT+DOUBLE+CTRL+MIDDLE 
      [middle_ctrl_double_shift] => SHIFT+DOUBLE+CTRL+MIDDLE 
      [middle_alt_ctrl_shift] => SHIFT+CTRL+ALT+MIDDLE 
      [middle_alt_ctrl_double] => DOUBLE+CTRL+ALT+MIDDLE 
      [middle_alt_shift_ctrl] => CTRL+SHIFT+ALT+MIDDLE 
      [middle_alt_shift_double] => DOUBLE+SHIFT+ALT+MIDDLE 
      [middle_alt_double_ctrl] => CTRL+DOUBLE+ALT+MIDDLE 
      [middle_alt_double_shift] => SHIFT+DOUBLE+ALT+MIDDLE 
      [middle_shift_ctrl_alt] => ALT+CTRL+SHIFT+MIDDLE 
      [middle_shift_ctrl_double] => DOUBLE+CTRL+SHIFT+MIDDLE 
      [middle_shift_alt_ctrl] => CTRL+ALT+SHIFT+MIDDLE 
      [middle_shift_alt_double] => DOUBLE+ALT+SHIFT+MIDDLE 
      [middle_shift_double_ctrl] => CTRL+DOUBLE+SHIFT+MIDDLE 
      [middle_shift_double_alt] => ALT+DOUBLE+SHIFT+MIDDLE 
      [middle_double_ctrl_alt] => ALT+CTRL+DOUBLE+MIDDLE 
      [middle_double_ctrl_shift] => SHIFT+CTRL+DOUBLE+MIDDLE 
      [middle_double_alt_ctrl] => CTRL+ALT+DOUBLE+MIDDLE 
      [middle_double_alt_shift] => SHIFT+ALT+DOUBLE+MIDDLE 
      [middle_double_shift_ctrl] => CTRL+SHIFT+DOUBLE+MIDDLE 
      [middle_double_shift_alt] => ALT+SHIFT+DOUBLE+MIDDLE 
     ) 

    [right] => RIGHT 
    [RIGHT] => Array 
     (
      [right_ctrl] => CTRL+RIGHT 
      [right_alt] => ALT+RIGHT 
      [right_shift] => SHIFT+RIGHT 
      [right_double] => DOUBLE+RIGHT 
      [right_ctrl_alt] => ALT+CTRL+RIGHT 
      [right_ctrl_shift] => SHIFT+CTRL+RIGHT 
      [right_ctrl_double] => DOUBLE+CTRL+RIGHT 
      [right_alt_ctrl] => CTRL+ALT+RIGHT 
      [right_alt_shift] => SHIFT+ALT+RIGHT 
      [right_alt_double] => DOUBLE+ALT+RIGHT 
      [right_shift_ctrl] => CTRL+SHIFT+RIGHT 
      [right_shift_alt] => ALT+SHIFT+RIGHT 
      [right_shift_double] => DOUBLE+SHIFT+RIGHT 
      [right_double_ctrl] => CTRL+DOUBLE+RIGHT 
      [right_double_alt] => ALT+DOUBLE+RIGHT 
      [right_double_shift] => SHIFT+DOUBLE+RIGHT 
      [right_ctrl_alt_shift] => SHIFT+ALT+CTRL+RIGHT 
      [right_ctrl_alt_double] => DOUBLE+ALT+CTRL+RIGHT 
      [right_ctrl_shift_alt] => ALT+SHIFT+CTRL+RIGHT 
      [right_ctrl_shift_double] => DOUBLE+SHIFT+CTRL+RIGHT 
      [right_ctrl_double_alt] => ALT+DOUBLE+CTRL+RIGHT 
      [right_ctrl_double_shift] => SHIFT+DOUBLE+CTRL+RIGHT 
      [right_alt_ctrl_shift] => SHIFT+CTRL+ALT+RIGHT 
      [right_alt_ctrl_double] => DOUBLE+CTRL+ALT+RIGHT 
      [right_alt_shift_ctrl] => CTRL+SHIFT+ALT+RIGHT 
      [right_alt_shift_double] => DOUBLE+SHIFT+ALT+RIGHT 
      [right_alt_double_ctrl] => CTRL+DOUBLE+ALT+RIGHT 
      [right_alt_double_shift] => SHIFT+DOUBLE+ALT+RIGHT 
      [right_shift_ctrl_alt] => ALT+CTRL+SHIFT+RIGHT 
      [right_shift_ctrl_double] => DOUBLE+CTRL+SHIFT+RIGHT 
      [right_shift_alt_ctrl] => CTRL+ALT+SHIFT+RIGHT 
      [right_shift_alt_double] => DOUBLE+ALT+SHIFT+RIGHT 
      [right_shift_double_ctrl] => CTRL+DOUBLE+SHIFT+RIGHT 
      [right_shift_double_alt] => ALT+DOUBLE+SHIFT+RIGHT 
      [right_double_ctrl_alt] => ALT+CTRL+DOUBLE+RIGHT 
      [right_double_ctrl_shift] => SHIFT+CTRL+DOUBLE+RIGHT 
      [right_double_alt_ctrl] => CTRL+ALT+DOUBLE+RIGHT 
      [right_double_alt_shift] => SHIFT+ALT+DOUBLE+RIGHT 
      [right_double_shift_ctrl] => CTRL+SHIFT+DOUBLE+RIGHT 
      [right_double_shift_alt] => ALT+SHIFT+DOUBLE+RIGHT 
     ) 

) 

私は少しキー/ラベルをreorderdが、それは本当に解決策を変更しませんでした。

1

あなたの要求は非常に選択的であり、完全な組み合わせ例alt_double_leftを含むがshift_double_leftていませんが私は例外リストを作成するために何をした何

に記載されていませんあなた...

変数

$a = array (// actions 
     'left' => 'LEFT', 
     'middle' => 'MIDDLE', 
     'right' => 'RIGHT' 
); 

$m = array (// modifiers 
     'ctrl' => 'CTRL', 
     'alt' => 'ALT', 
     'shift' => 'SHIFT', 
     'double' => 'DOUBLE' 
); 

$exceptions = array (
     array (
       "shift", 
       "double" 
     ) , 

     array (
       "double", 
       "ctrl" 
     ), 


     array (
       "double", 
       "alt" 
     ) 
); 

$mc = power_perms (array_keys ($m)); 
$options = array(); 

ループ

echo "<pre>"; 

foreach ($a as $aKey => $aValue) { 
    $options [$aValue] = isset ($options [$aKey]) ? $options [$aKey] : array(); 
    foreach ($mc as $mKey => $mValue) { 
     $cKey = implode ("_", $mValue); 
     $cKey .= "_" . $aKey; 

     $cValue = implode ("+", $mValue); 
     $cValue = strtoupper ($cValue . "+" . $aValue); 
     if (eCheck ($exceptions, $cKey)) { 
      continue; 
     } 
     $options [$aValue] [$cKey] = $cValue; 

    } 
} 

print_r ($options); 

機能

function eCheck($exceptions, $cKey) { 

    foreach ($exceptions as $eValue) { 

     if (strpos ($cKey, "{$eValue[0]}_{$eValue[1]}") !== false) { 
      return true; 
     } 
     if (strpos ($cKey, "{$eValue[1]}_{$eValue[0]}") !== false) { 
      return true; 
     } 

    } 

    return false; 
} 
function power_perms($arr) { 

    $power_set = power_set ($arr); 
    $result = array(); 
    foreach ($power_set as $set) { 
     $perms = perms ($set); 
     $result = array_merge ($result, $perms); 
    } 
    return $result; 
} 

function power_set($in, $minLength = 1) { 

    $count = count ($in); 
    $members = pow (2, $count); 
    $return = array(); 
    for($i = 0; $i < $members; $i ++) { 
     $b = sprintf ("%0" . $count . "b", $i); 
     $out = array(); 
     for($j = 0; $j < $count; $j ++) { 
      if ($b {$j} == '1') 
       $out [] = $in [$j]; 
     } 
     if (count ($out) >= $minLength) { 
      $return [] = $out; 
     } 
    } 

    // usort($return,"cmp"); //can sort here by length 
    return $return; 
} 

function factorial($int) { 
    if ($int < 2) { 
     return 1; 
    } 

    for($f = 2; $int - 1 > 1; $f *= $int --) 
     ; 

    return $f; 
} 

function perm($arr, $nth = null) { 

    if ($nth === null) { 
     return perms ($arr); 
    } 

    $result = array(); 
    $length = count ($arr); 

    while ($length --) { 
     $f = factorial ($length); 
     $p = floor ($nth/$f); 
     $result [] = $arr [$p]; 
     array_delete_by_key ($arr, $p); 
     $nth -= $p * $f; 
    } 

    $result = array_merge ($result, $arr); 
    return $result; 
} 

function perms($arr) { 
    $p = array(); 
    for($i = 0; $i < factorial (count ($arr)); $i ++) { 
     $p [] = perm ($arr, $i); 
    } 
    return $p; 
} 

function array_delete_by_key(&$array, $delete_key, $use_old_keys = FALSE) { 

    unset ($array [$delete_key]); 

    if (! $use_old_keys) { 
     $array = array_values ($array); 
    } 

    return TRUE; 
} 

出力

Array 
(
    [LEFT] => Array 
     (
      [double_left] => DOUBLE+LEFT 
      [shift_left] => SHIFT+LEFT 
      [alt_left] => ALT+LEFT 
      [alt_shift_left] => ALT+SHIFT+LEFT 
      [shift_alt_left] => SHIFT+ALT+LEFT 
      [ctrl_left] => CTRL+LEFT 
      [ctrl_shift_left] => CTRL+SHIFT+LEFT 
      [shift_ctrl_left] => SHIFT+CTRL+LEFT 
      [ctrl_alt_left] => CTRL+ALT+LEFT 
      [alt_ctrl_left] => ALT+CTRL+LEFT 
      [ctrl_alt_shift_left] => CTRL+ALT+SHIFT+LEFT 
      [ctrl_shift_alt_left] => CTRL+SHIFT+ALT+LEFT 
      [alt_ctrl_shift_left] => ALT+CTRL+SHIFT+LEFT 
      [alt_shift_ctrl_left] => ALT+SHIFT+CTRL+LEFT 
      [shift_ctrl_alt_left] => SHIFT+CTRL+ALT+LEFT 
      [shift_alt_ctrl_left] => SHIFT+ALT+CTRL+LEFT 
     ) 

    [MIDDLE] => Array 
     (
      [double_middle] => DOUBLE+MIDDLE 
      [shift_middle] => SHIFT+MIDDLE 
      [alt_middle] => ALT+MIDDLE 
      [alt_shift_middle] => ALT+SHIFT+MIDDLE 
      [shift_alt_middle] => SHIFT+ALT+MIDDLE 
      [ctrl_middle] => CTRL+MIDDLE 
      [ctrl_shift_middle] => CTRL+SHIFT+MIDDLE 
      [shift_ctrl_middle] => SHIFT+CTRL+MIDDLE 
      [ctrl_alt_middle] => CTRL+ALT+MIDDLE 
      [alt_ctrl_middle] => ALT+CTRL+MIDDLE 
      [ctrl_alt_shift_middle] => CTRL+ALT+SHIFT+MIDDLE 
      [ctrl_shift_alt_middle] => CTRL+SHIFT+ALT+MIDDLE 
      [alt_ctrl_shift_middle] => ALT+CTRL+SHIFT+MIDDLE 
      [alt_shift_ctrl_middle] => ALT+SHIFT+CTRL+MIDDLE 
      [shift_ctrl_alt_middle] => SHIFT+CTRL+ALT+MIDDLE 
      [shift_alt_ctrl_middle] => SHIFT+ALT+CTRL+MIDDLE 
     ) 

    [RIGHT] => Array 
     (
      [double_right] => DOUBLE+RIGHT 
      [shift_right] => SHIFT+RIGHT 
      [alt_right] => ALT+RIGHT 
      [alt_shift_right] => ALT+SHIFT+RIGHT 
      [shift_alt_right] => SHIFT+ALT+RIGHT 
      [ctrl_right] => CTRL+RIGHT 
      [ctrl_shift_right] => CTRL+SHIFT+RIGHT 
      [shift_ctrl_right] => SHIFT+CTRL+RIGHT 
      [ctrl_alt_right] => CTRL+ALT+RIGHT 
      [alt_ctrl_right] => ALT+CTRL+RIGHT 
      [ctrl_alt_shift_right] => CTRL+ALT+SHIFT+RIGHT 
      [ctrl_shift_alt_right] => CTRL+SHIFT+ALT+RIGHT 
      [alt_ctrl_shift_right] => ALT+CTRL+SHIFT+RIGHT 
      [alt_shift_ctrl_right] => ALT+SHIFT+CTRL+RIGHT 
      [shift_ctrl_alt_right] => SHIFT+CTRL+ALT+RIGHT 
      [shift_alt_ctrl_right] => SHIFT+ALT+CTRL+RIGHT 
     ) 

) 

デモリンクはhttp://codepad.viper-7.com/WzLQk8

+0

もし私がそれを見逃してしまったら、それはオーバーセイトでした。私は選択する必要はありません、私はそれらのすべてを行う必要がありますが、あなたの例が行うshift_ctrl_alt_left&shift_alt_ctrl_leftのような同じ組み合わせの2つを異なる順序で持つことは望ましくありません。そのビットを変更する上でのアイデアですか? –

+0

除外リストに 'array(" shift "、" alt ")' AND '配列(" shift "、" ctrl ")'を追加するだけです.... – Baba

+0

なぜこれを選択しなかったのかを明確にするため解決策の3番目のリストを維持することは私にとって妥当ではありません。私はshift_ctrl_alt_leftとshift_alt_ctrl_leftのような重複したエントリーを並べ替えることはしませんでした。あなたの手を試してくれてありがとう。 –

0

これは動作するはず

foreach($a as $key=>$val){ 
    $options[$key]=$val; 
    $m_temp=$m; 
    while(is_array($m_temp)){ 
     $options[$val][implode('_', $m_temp).'_'.$key] = implode('_', array_value($m_temp)).'_'.$val; 
     $m_temp=array_pop($m_temp); 
    } 
    $m=$m_temp; 
} 
+0

申し訳ありませんが、私にとってはうまくいかないようです:http://ideone.com/a5X0A –

関連する問題