获取自上次值更改以来的最后更改

发布于 2024-08-06 13:24:46 字数 1147 浏览 1 评论 0原文

I want to check the last value changes.
Some times the objectId is the same as another objectId but the value can be different.
And i cant compare this to get the Last changes.
How do i do that?

这是对象

  object(stdClass)#38 (6) {
      ["id"]=>
      string(7) "1715680"
      ["objectId"]=>
      string(1) "1"
      ["type"]=>
      string(1) "0"
      ["field"]=>
      string(2) "30"
      ["value"]=>
      string(1) "3"
      ["date"]=>
      string(10) "1239982220"
    }
    object(stdClass)#39 (6) {
      ["id"]=>
      string(7) "1739382"
      ["objectId"]=>
      string(1) "1"
      ["type"]=>
      string(1) "0"
      ["field"]=>
      string(2) "30"
      ["value"]=>
      string(1) "3"
      ["date"]=>
      string(10) "1240588802"
    }
    object(stdClass)#40 (6) {
      ["id"]=>
      string(7) "1762456"
      ["objectId"]=>
      string(1) "1"
      ["type"]=>
      string(1) "0"
      ["field"]=>
      string(2) "30"
      ["value"]=>
      string(1) "0"
      ["date"]=>
      string(10) "1241195393"
    }
I want to check the last value changes.
Some times the objectId is the same as another objectId but the value can be different.
And i cant compare this to get the Last changes.
How do i do that?

This are the Objects

  object(stdClass)#38 (6) {
      ["id"]=>
      string(7) "1715680"
      ["objectId"]=>
      string(1) "1"
      ["type"]=>
      string(1) "0"
      ["field"]=>
      string(2) "30"
      ["value"]=>
      string(1) "3"
      ["date"]=>
      string(10) "1239982220"
    }
    object(stdClass)#39 (6) {
      ["id"]=>
      string(7) "1739382"
      ["objectId"]=>
      string(1) "1"
      ["type"]=>
      string(1) "0"
      ["field"]=>
      string(2) "30"
      ["value"]=>
      string(1) "3"
      ["date"]=>
      string(10) "1240588802"
    }
    object(stdClass)#40 (6) {
      ["id"]=>
      string(7) "1762456"
      ["objectId"]=>
      string(1) "1"
      ["type"]=>
      string(1) "0"
      ["field"]=>
      string(2) "30"
      ["value"]=>
      string(1) "0"
      ["date"]=>
      string(10) "1241195393"
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沦落红尘 2024-08-13 13:24:46

我解决了我自己的问题不是很好吗?

$changed = false;

        while($z = $this->db->fetch($m))
        {
            $array[$z->objectId][$z->field][] = $z;
        }

        for($i = 0; $i < count($array); $i++)
        {

            $blogs = $array[1][30];

            foreach($blogs as $blog)
            {
                $blogs[$i];
                if($blog->value != $blogs[$i]->value)
                {
                        $changed = true;
                }


            }

        }

I solved My Own Question isnt that good?

$changed = false;

        while($z = $this->db->fetch($m))
        {
            $array[$z->objectId][$z->field][] = $z;
        }

        for($i = 0; $i < count($array); $i++)
        {

            $blogs = $array[1][30];

            foreach($blogs as $blog)
            {
                $blogs[$i];
                if($blog->value != $blogs[$i]->value)
                {
                        $changed = true;
                }


            }

        }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文