如何在php中内爆多个数组?

如何在php中内爆多个数组?,php,arrays,implode,Php,Arrays,Implode,我想在php中内爆多个数组 比如说 $day[] = array (1,2,3,4,5); $month[] = array (1,2,3,4,5); $year[] = array (2001,2002,2003,2004,2005); $date = implode(";",$day."/".$month."/".$year); 我希望输出是正确的 2001年1月1日;2/2/2002;3/3/2003;4/4/2004;5/5/2005 这是可能的,实际上已经尝试过了,但它不起作用。你能

我想在php中内爆多个数组 比如说

$day[] = array (1,2,3,4,5);
$month[] = array (1,2,3,4,5);
$year[] = array (2001,2002,2003,2004,2005);
$date = implode(";",$day."/".$month."/".$year);
我希望输出是正确的

2001年1月1日;2/2/2002;3/3/2003;4/4/2004;5/5/2005


这是可能的,实际上已经尝试过了,但它不起作用。你能帮我解决这个问题吗

下面的代码使用所需的内部格式创建一个数组,然后将其内爆。请注意,此代码假定每个数组的元素数相等。另外,确保这些值没有分隔符,例如
/

$day[] = array (1,2,3,4,5);
$month[] = array (1,2,3,4,5);
$year[] = array (2001,2002,2003,2004,2005);
$arr = array();
for ($index = 0; $index < count($day); $index++) {
    $arr[$index] = $month[$index]."/".$day[$index]."/".$year[$index];
}
$result = implode(";", $arr);
$day[]=数组(1,2,3,4,5);
$month[]=数组(1,2,3,4,5);
$year[]=阵列(20012002200320042005);
$arr=array();
对于($index=0;$index
试试这个

$dates = array();
foreach ($day as $key => $val) {
  $dates[] = $day[$key]."/".$month[$key]."/".$year[$key];
}
$allDates = implode(";",$dates);

这叫做循环,欢迎使用编程。但是,当您创建多维数组时,您的代码一开始就是错误的。阅读手册,看看它接受哪些参数。Syed,这样你只会重复结果。你将有一个新的机会;在其末尾,这与op指定的格式明显不同。此外,op可能也希望在其他地方使用结果,但您的代码假定结果将仅被回送。这种假设是不成熟的,因为op的代码中没有回声。