public function WriteNewArrayAndItsContents($array, $arrayOpened = false, $tabAmount = 0) {
        $output = "";
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $output .= $this->WriteAssociativeArrayValueAsNewArray($key, $tabAmount); //new array opened
                $output .= $this->WriteNewArrayAndItsContents($value, true, $tabAmount);
            } else {
                $output .= $this->WriteAssociativeArrayValueWithKeyAndValue($key, $value, $tabAmount);
            }
        }
        if ($arrayOpened) {
            $output .= $this->CloseArray($tabAmount - 1);
        }
        return $output;
    }
public function WriteNewArrayAndItsContents($array, $arrayOpened = false, $tabAmount = 0) {
        $output = "";
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $output .= $this->WriteAssociativeArrayValueAsNewArray($key, $tabAmount); //new array opened
                $output .= $this->WriteNewArrayAndItsContents($value, true, $tabAmount);
            } else {
                $output .= $this->WriteAssociativeArrayValueWithKeyAndValue($key, $value, $tabAmount);
            }
        }
        if ($arrayOpened) {
            $output .= $this->CloseArray($tabAmount - 1);
        }
        return $output;
    }
public function WriteNewArrayAndItsContents ( $ array , $ arrayOpened = false , $ tabAmount = 0 ) { $ output = "" ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ output .= $ this -> WriteAssociativeArrayValueAsNewArray ( $ key , $ tabAmount ) ; //new array opened $ output .= $ this -> WriteNewArrayAndItsContents ( $ value , true , $ tabAmount ) ; } else { $ output .= $ this -> WriteAssociativeArrayValueWithKeyAndValue ( $ key , $ value , $ tabAmount ) ; } } if ( $ arrayOpened ) { $ output .= $ this -> CloseArray ( $ tabAmount - 1 ) ; } return $ output ; }
Recursively writes an array from an array of values.

@param array $array the array to loop through to generate the values given.
@param type $arrayOpened flag to specify if an array is opened and needs to
be closed before moving on.
@param type $tabAmount the number of tabs or 2 spaces to print in the generated
code.
@return string the code generated.
Recursively writes an array from an array of values .