compact() Is Recursive

../_images/compact_is_recursive.png

compact() accepts an array of strings… and arrays. It uses the available arguments recursively, yet produces an array with only one level: the deep nesting is lots at compacting type.

In fact, if the variables are indeed available at compact() time, compact flattens the array, and turns it into a simple list.

It also means that it is prone to recursive error.

See Also

PHP Error Messages

PHP Features