比较两个相同的数组将返回false

时间:2018-12-27 22:54:20

标签: php arrays cookies

我想使用以下代码将两个数组相互比较:

if($jobids !== null){


    if (isset($_COOKIE["djsearchquery"])){


        $cookiequery[] = unserialize($_COOKIE['djsearchquery']);

        $arrayequal = ($cookiequery == $jobids);


        $consolelog = $cookiequery;
        $consolelog[] = $jobids;            
        $consolelog[] = $arrayequal;


        if($arrayequal == false){

            $response = array(
                'jobids' => $jobids,
                'markerpositions'  => $markerpositions,
                'consolelog'  => $consolelog
            );


            setcookie('djsearchquery', serialize($jobids), time()+3600);
            echo json_encode($response);

        }

    }

在控制台中,阵列的图片完全相同:  Picture of the console-log:

有人可以向我解释为什么$arrayequal返回false吗?我不明白。

1 个答案:

答案 0 :(得分:2)

尝试更改

GenericAPIView

npm i -g gulp gulp-cli