请问二维数组矩阵算法

请教二维数组矩阵算法$ary = array( 'a'=>array('a1','a2'), 'b'=>array('b1','b2'), 'c'=>array('c1','c2'),);如何把上面的数组,输出到页面成这样啊------解决方案--------------------echo '';foreach($ary['a'] as $av){ foreach($ary['b'] as $bv){ foreach($ary['c'] as $cv){ echo "$av$bv$cv"; } }}echo '';------解决方案--------------------

本帖最后由 xuzuning 于 2014-07-10 18:39:24 编辑

$ary = array( 'a'=>array('a1','a2'), 'b'=>array('b1','b2'), 'c'=>array('c1','c2'),);echo "\n";echo "abc\n";foreach($ary['a'] as $m) { foreach($ary['b'] as $n) { foreach($ary['c'] as $v) { echo "$m$n$v\n"; } }}echo "";[code=html]abca1b1c1a1b1c2a1b2c1a1b2c2a2b1c1a2b1c2a2b2c1a2b2c2/code]------解决方案--------------------精华区 迪尔卡积 我问的问题....前后几篇 很完整了

分享这篇文章:
收藏+0