Calculate the highest duplicate integers of two associative arrays

后端 未结 4 1740
清歌不尽
清歌不尽 2021-01-25 11:19

Given 2 associative arrays:

$fruits  = array ( \"d\" => \"lemon\", \"a\" => \"orange\", \"b\" => \"banana\", \"c\" => \"apple\" );
$fruits2 = array          


        
4条回答
  •  一个人的身影
    2021-01-25 12:11

    Use array array_values ( array $input ) function and compare them.

     $value1=array_values($fruits);
     $value2=array_values($fruits2);
    
     for ( $i = 0; $i < count($value1); $i++)
     {
       $test[] = $value1[$i] == $value2[$i] ? TRUE : FLASE;
     }
    

提交回复
热议问题