Home  >  Article  >  Backend Development  >  关于php的array_uintersect_uassoc设置返回值输出不是预料中的!

关于php的array_uintersect_uassoc设置返回值输出不是预料中的!

WBOY
WBOYOriginal
2016-06-06 20:47:571006browse

<code>function keys($k1,$k2){
    if($k1==$k2){
        return 1;
    }
return 0;}
function value($v1,$v2){
    if($v1>$v2){
        return 0;
    }elseif($v1'123','2'=>'234','3'=>'345');
$b = array('2'>'234','3'=>'456','4'=>'567');
print_r(array_uintersect_uassoc($a,$b,'keys','value'));
//Array ( [2] => 234 [3] => 345 ) 
</code>

符合keys和value的只有 [3] => 345
[2] => 234 为什么也输出了? 这不符合value。

回复内容:

<code>function keys($k1,$k2){
    if($k1==$k2){
        return 1;
    }
return 0;}
function value($v1,$v2){
    if($v1>$v2){
        return 0;
    }elseif($v1'123','2'=>'234','3'=>'345');
$b = array('2'>'234','3'=>'456','4'=>'567');
print_r(array_uintersect_uassoc($a,$b,'keys','value'));
//Array ( [2] => 234 [3] => 345 ) 
</code>

符合keys和value的只有 [3] => 345
[2] => 234 为什么也输出了? 这不符合value。

http://cn2.php.net/manual/zh/function.key.php

key()这个函数了骚年

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn