private function genArrayHash(array $var)
    {
        static $dump;

        if (!isset($dump)) {
            $dump = [];
        }

        if (in_array($var, $dump, true)) {
            return 'array recursion';
        }

        $dump[] = $var;

        $hash = [];
        foreach ($var as $k => $v) {
            if (is_object($v)) {
                $hash[$k] = spl_object_hash($v);
            } elseif (is_array($v)) {
                $hash[$k] = $this->genArrayHash($v);
            } elseif (is_resource($v)) {
                $hash[$k] = intval($v) . get_resource_type($v);
            } else {
                $hash[$k] = $v;
            }
        }

        $hash = json_encode($hash);

        array_pop($dump);

        return $hash;
    }
private function genArrayHash(array $var)
    {
        static $dump;

        if (!isset($dump)) {
            $dump = [];
        }

        if (in_array($var, $dump, true)) {
            return 'array recursion';
        }

        $dump[] = $var;

        $hash = [];
        foreach ($var as $k => $v) {
            if (is_object($v)) {
                $hash[$k] = spl_object_hash($v);
            } elseif (is_array($v)) {
                $hash[$k] = $this->genArrayHash($v);
            } elseif (is_resource($v)) {
                $hash[$k] = intval($v) . get_resource_type($v);
            } else {
                $hash[$k] = $v;
            }
        }

        $hash = json_encode($hash);

        array_pop($dump);

        return $hash;
    }
private function genArrayHash ( array $ var ) { static $ dump ; if ( ! isset ( $ dump ) ) { $ dump = [ ] ; } if ( in_array ( $ var , $ dump , true ) ) { return 'array recursion' ; } $ dump [ ] = $ var ; $ hash = [ ] ; foreach ( $ var as $ k => $ v ) { if ( is_object ( $ v ) ) { $ hash [ $ k ] = spl_object_hash ( $ v ) ; } elseif ( is_array ( $ v ) ) { $ hash [ $ k ] = $ this -> genArrayHash ( $ v ) ; } elseif ( is_resource ( $ v ) ) { $ hash [ $ k ] = intval ( $ v ) . get_resource_type ( $ v ) ; } else { $ hash [ $ k ] = $ v ; } } $ hash = json_encode ( $ hash ) ; array_pop ( $ dump ) ; return $ hash ; }
Generate hash id for given array

@param array $var

@return string
Generate hash id for given array