0

Is there any way to detect if a PHP array is recursive?

For example, consider the following code:

   $a = ['value', &$a];

How can I loop through the array $a and detect the recursion?

Richi RM
  • 829
  • 3
  • 11
  • See also [How to check for circular references in PHP when recursively parsing an associative array?](https://stackoverflow.com/questions/23880770/how-to-check-for-circular-references-in-php-when-recursively-parsing-an-associat) – ggorlen Nov 08 '21 at 14:16
  • Thank you. It is missed that PHP has a native function to detect recursive arrays. – Richi RM Nov 08 '21 at 14:23

0 Answers0