mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 17:13:49 +00:00
16 lines
512 B
PHP
16 lines
512 B
PHP
<?php
|
|
|
|
/**
|
|
* Recursively converts an object or array to a multi-dimensional array.
|
|
*
|
|
* @param mixed $obj The object or array to be converted. If the value is neither an object nor an array, it will be returned as is.
|
|
*
|
|
* @return array A multi-dimensional array representation of the input object or array.
|
|
*/
|
|
function object_to_array($obj) {
|
|
if (!is_object($obj) && !is_array($obj)) { return $obj; }
|
|
if (is_object($obj)) { $obj = get_object_vars($obj); }
|
|
return array_map('object_to_array', $obj);
|
|
}
|
|
|
|
?>
|