<?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)