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

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

WBOY
Release: 2016-06-06 20:47:57
Original
1029 people have browsed it

<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>
Copy after login
Copy after login

符合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>
Copy after login
Copy after login

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

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

key()这个函数了骚年

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template