Settings | Sign in | Sign up

There are currently 2 posts.

【跪求】php数组问题

Floor 1 巨大八爪鱼 11/21/10 13:49
$a1=array(0,5,8,11,22,65);
$a2=array(0,8,5,25,22,11,65);
用什么代码可以对齐这两个数组中的相同元素,使其成为:
$a1=array(0,5,8,11,22,65);
$a2=array(0,5,8,11,22,65,25);
而且如果像下面这样缺元素的话,则:
$a1=array(1,2,3,4);
$a2=array(2,3);
对齐为
$a1=array(1,2,3,4);
$a2=array(null,2,3);
Floor 2 巨大八爪鱼 11/21/10 13:51

$a1=array(1,2,3,4); $a2=array(1,4,3,7); 要使其对齐成为 $a1=array(1,2,3,4); $a2=array(1,7,3,4); 第二个数组中没有2的话就不参与对齐。

Content converter:

Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
©2010-2025 Purasbar Ver3.0 [Mobile] [Desktop]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported license.