public static function toString($array = null, $inner_glue = '=', $outer_glue = ' ', $keepOuterKey = false)
    {
        $output = array();

        if ($array instanceof AnConfig) {
            $data = array();
            foreach ($array as $key => $item) {
                $data[$key] = (string) $item;
            }
            $array = $data;
        }

        if (is_object($array)) {
            $array = (array) AnConfig::unbox($array);
        }

        if (is_array($array)) {
            foreach ($array as $key => $item) {
                if (is_array($item)) {
                    if ($keepOuterKey) {
                        $output[] = $key;
                    }
                    // This is value is an array, go and do it again!
                    $output[] = AnHelperArray::toString($item, $inner_glue, $outer_glue, $keepOuterKey);
                } else {
                    $output[] = $key.$inner_glue.'"'.str_replace('"', '&quot;', $item).'"';
                }
            }
        }

        return implode($outer_glue, $output);
    }
public static function toString($array = null, $inner_glue = '=', $outer_glue = ' ', $keepOuterKey = false)
    {
        $output = array();

        if ($array instanceof AnConfig) {
            $data = array();
            foreach ($array as $key => $item) {
                $data[$key] = (string) $item;
            }
            $array = $data;
        }

        if (is_object($array)) {
            $array = (array) AnConfig::unbox($array);
        }

        if (is_array($array)) {
            foreach ($array as $key => $item) {
                if (is_array($item)) {
                    if ($keepOuterKey) {
                        $output[] = $key;
                    }
                    // This is value is an array, go and do it again!
                    $output[] = AnHelperArray::toString($item, $inner_glue, $outer_glue, $keepOuterKey);
                } else {
                    $output[] = $key.$inner_glue.'"'.str_replace('"', '&quot;', $item).'"';
                }
            }
        }

        return implode($outer_glue, $output);
    }
public static function toString ( $ array = null , $ inner_glue = '=' , $ outer_glue = ' ' , $ keepOuterKey = false ) { $ output = array ( ) ; if ( $ array instanceof AnConfig ) { $ data = array ( ) ; foreach ( $ array as $ key => $ item ) { $ data [ $ key ] = ( string ) $ item ; } $ array = $ data ; } if ( is_object ( $ array ) ) { $ array = ( array ) AnConfig :: unbox ( $ array ) ; } if ( is_array ( $ array ) ) { foreach ( $ array as $ key => $ item ) { if ( is_array ( $ item ) ) { if ( $ keepOuterKey ) { $ output [ ] = $ key ; } // This is value is an array, go and do it again! $ output [ ] = AnHelperArray :: toString ( $ item , $ inner_glue , $ outer_glue , $ keepOuterKey ) ; } else { $ output [ ] = $ key . $ inner_glue . '"' . str_replace ( '"' , '&quot;' , $ item ) . '"' ; } } } return implode ( $ outer_glue , $ output ) ; }
Utility function to map an array to a string

@static
@param   array|object    The array or object to transform into a string
@param   string          The inner glue to use, default '='
@param   string          The outer glue to use, default ' '
@param   boolean
@return  string  The string mapped from the given array
Utility function to map an array to a string