我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

测试递归数组上的引用相等性

<?php
$a = [];
$b = [&$a];
$a[] = &$b;

Assuming we have a recursive array - is there any PHP builtin that will test for equality including references?

Standard comparison operators throw a fatal error, and while array_diff doesn't crash it does spit out a ton of notices.

I could always compare print_r($a, true) == print_r($b, true) but this would incorrectly identify $a and $b as the same (Their values may be the same but the references they contain aren't)

近期文章

  • 在MySQL中使用LOAD DATA INFILE限制输入行
  • 连接到另一台机器的反应服务器
  • 如何使用PHP mysql查询对数组值进行排序
  • wp超级缓存更新缓存仅在发布更新时
  • 基于mysql查询的Php自动增量列
  • 返回除给定键之外的所有数组元素
  • PHP多维数组到单个数组
  • Laravel group by如果没有行,则返回零
  • 没有超级权限更改MySQL时区
  • 在ion_auth配置文件中,“加入”意味着什么
  • 具有特殊字符的NSURL(åäö)
  • mouseover透明div类来显示图像
  • 如何在PHP中正确获取Cookie的价值? [关闭]
  • 使用php代码删除无用的零号后
  • 如何检查表中是否更新了密码
  • get_meta_tags适用于URL,但不适用于本地文件
  • doctrine:schema:update不遵守列顺序
  • php重定向后显示通知的最佳方式
  • 使用XMLWriter将变量数据输出为CDATA XML
  • 在Laravel上使用模型的全局事件

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华