用的foreach三个变量添加 [英] foreach with three variables add
本文介绍了用的foreach三个变量添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用的foreach函数3 变量
i want to use foreach function for 3 variables
我用这个code在我的网页:
i use this code in my page:
foreach (array_combine($online_order_name, $online_order_q) as $online_order_name1 =>
$online_order_q1) {
mysql_query("insert into .......
}
我怎么可以这样做:
how can i do that like :
<?
foreach (array_combine($online_order_name, $online_order_q,$third_variable) as
$online_order_name1 => $online_order_q1 => $third_variable2) {
?>
感谢您
推荐答案
我想这将解决你的需要:
I guess this will solve your need:
<?php
$A=array(1,2,3);
$B=array('a','b','c');
$C=array('x','y','z');
foreach (array_map(NULL, $A, $B, $C) as $x) {
list($a, $b, $c) = $x;
echo "$a $b $c\n";
}
这篇关于用的foreach三个变量添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文