english/libraries/joomla/utilities/arrayhelper.php
/**
	 * Utility function to map an object or array to an array
	 *
	 * @param   mixed    The source object or array
	 * @param   boolean  True to recurve through multi-level objects
	 * @param   string   An optional regular expression to match on field names
	 *
	 * @return  array  The array mapped from the given object
	 *
	 * @since   11.1
	 */
Utility function to map an object or array to an array
@param   mixed    The source object or array
@param   boolean  True to recurve through multi-level objects
@param   string   An optional regular expression to match on field names

@return  array  The array mapped from the given object


Utility function to map an object or array to an array @param mixed The source object or array @param boolean True to recurve through multi - level objects @param string An optional regular expression to match on field names @return array The array mapped from the given object
protected static function _fromObject($item, $recurse, $regex)
	{
		if (is_object($item))
		{
			$result = array();
			foreach (get_object_vars($item) as $k => $v)
			{
				if (!$regex || preg_match($regex, $k))
				{
					if ($recurse) {
						$result[$k] = self::_fromObject($v, $recurse, $regex);
					}
					else {
						$result[$k] = $v;
					}
				}
			}
		}
		elseif (is_array($item))
		{
			$result = array();
			foreach ($item as $k => $v)
			{
				if ($recurse) {
					$result[$k] = self::_fromObject($v, $recurse, $regex);
				}
				else {
					$result[$k] = $v;
				}
			}
		}
		else
		{
			$result = $item;
		}
		return $result;
	}
protected static function _fromObject ( $ item , $ recurse , $ regex ) { if ( is_object ( $ item ) ) { $ result = array ( ) ; foreach ( get_object_vars ( $ item ) as $ k => $ v ) { if ( ! $ regex || preg_match ( $ regex , $ k ) ) { if ( $ recurse ) { $ result [ $ k ] = self :: _fromObject ( $ v , $ recurse , $ regex ) ; } else { $ result [ $ k ] = $ v ; } } } } elseif ( is_array ( $ item ) ) { $ result = array ( ) ; foreach ( $ item as $ k => $ v ) { if ( $ recurse ) { $ result [ $ k ] = self :: _fromObject ( $ v , $ recurse , $ regex ) ; } else { $ result [ $ k ] = $ v ; } } } else { $ result = $ item ; } return $ result ; }
Utility function to map an object or array to an array
 @param   mixed    The source object or array
 @param   boolean  True to recurve through multi-level objects
 @param   string   An optional regular expression to match on field names
Utility function to map an object or array to an array @param mixed The source object or array @param boolean True to recurve through multi - level objects @param string An optional regular expression to match on field names