protected function serializeArray(array $arr, $indentation = 0, $tab = self::TAB)
    {
        $tabs = '';
        $closeTabs = '';
        for ($i = 0; $i < $indentation; $i++) {
            $tabs .= $tab;
            if ($i < $indentation - 1) {
                $closeTabs .= $tab;
            }
        }
        $string = 'array(';
        foreach ($arr as $key => $value) {
            $key = addslashes($key);
            $string .= (is_numeric($key) ? PHP_EOL . "$tabs $key => " : PHP_EOL . "$tabs'$key' => ");
            if (is_array($value)) {
                if (empty($value)) {
                    $string .= 'array()';
                } else {
                    $string .= $this->serializeArray($value, $indentation + 1, $tab);
                }
            } else {
                $string .= (General::strlen($value) > 0 ? var_export($value, true) : 'null');
            }
            $string .= ",";
        }
        $string .=  PHP_EOL . "$closeTabs)";
        return $string;
    }
protected function serializeArray(array $arr, $indentation = 0, $tab = self::TAB)
    {
        $tabs = '';
        $closeTabs = '';
        for ($i = 0; $i < $indentation; $i++) {
            $tabs .= $tab;
            if ($i < $indentation - 1) {
                $closeTabs .= $tab;
            }
        }
        $string = 'array(';
        foreach ($arr as $key => $value) {
            $key = addslashes($key);
            $string .= (is_numeric($key) ? PHP_EOL . "$tabs $key => " : PHP_EOL . "$tabs'$key' => ");
            if (is_array($value)) {
                if (empty($value)) {
                    $string .= 'array()';
                } else {
                    $string .= $this->serializeArray($value, $indentation + 1, $tab);
                }
            } else {
                $string .= (General::strlen($value) > 0 ? var_export($value, true) : 'null');
            }
            $string .= ",";
        }
        $string .=  PHP_EOL . "$closeTabs)";
        return $string;
    }
protected function serializeArray ( array $ arr , $ indentation = 0 , $ tab = self :: TAB ) { $ tabs = '' ; $ closeTabs = '' ; for ( $ i = 0 ; $ i < $ indentation ; $ i ++ ) { $ tabs .= $ tab ; if ( $ i < $ indentation - 1 ) { $ closeTabs .= $ tab ; } } $ string = 'array(' ; foreach ( $ arr as $ key => $ value ) { $ key = addslashes ( $ key ) ; $ string .= ( is_numeric ( $ key ) ? PHP_EOL . "$tabs $key => " : PHP_EOL . "$tabs'$key' => " ) ; if ( is_array ( $ value ) ) { if ( empty ( $ value ) ) { $ string .= 'array()' ; } else { $ string .= $ this -> serializeArray ( $ value , $ indentation + 1 , $ tab ) ; } } else { $ string .= ( General :: strlen ( $ value ) > 0 ? var_export ( $ value , true ) : 'null' ) ; } $ string .= "," ; } $ string .= PHP_EOL . "$closeTabs)" ; return $ string ; }
The `serializeArray` function will properly format and indent multidimensional
arrays using recursivity.

`__toString()` call `serializeArray` to use the recursive condition.
The keys (int) in array won't have apostrophe.
Array without multidimensional array will be output with normal indentation.
@return string
A string that contains a array representation of the '$data parameter'.
@param array $arr
A array of properties to serialize.
@param integer $indentation
The current level of indentation.
@param string $tab
A horizontal tab
The serializeArray function will properly format and indent multidimensional arrays using recursivity .