private function makeArrayField($fieldname, $arrayData, $postFields) {
        foreach ($arrayData as $key => $value) {
            $key = urlencode($key);
            if (is_object($value)) {
                $value = (array)$value;
            }
            if (is_array($value)) { //the value is an array, call the function recursively
                $newfieldname = $fieldname . "[$key]";
                $postFields = $this->makeArrayField($newfieldname, $value, $postFields);
            } else {
                $postFields[] = $fieldname . "[$key]=" . urlencode($value);
            }
        }
        return $postFields;
    }
private function makeArrayField($fieldname, $arrayData, $postFields) {
        foreach ($arrayData as $key => $value) {
            $key = urlencode($key);
            if (is_object($value)) {
                $value = (array)$value;
            }
            if (is_array($value)) { //the value is an array, call the function recursively
                $newfieldname = $fieldname . "[$key]";
                $postFields = $this->makeArrayField($newfieldname, $value, $postFields);
            } else {
                $postFields[] = $fieldname . "[$key]=" . urlencode($value);
            }
        }
        return $postFields;
    }
private function makeArrayField ( $ fieldname , $ arrayData , $ postFields ) { foreach ( $ arrayData as $ key => $ value ) { $ key = urlencode ( $ key ) ; if ( is_object ( $ value ) ) { $ value = ( array ) $ value ; } if ( is_array ( $ value ) ) { //the value is an array, call the function recursively $ newfieldname = $ fieldname . "[$key]" ; $ postFields = $ this -> makeArrayField ( $ newfieldname , $ value , $ postFields ) ; } else { $ postFields [ ] = $ fieldname . "[$key]=" . urlencode ( $ value ) ; } } return $ postFields ; }
Recursive function formating an array in POST parameter

@param array $arraydata - the array that we are going to format and add into &$data array
@param string $currentdata - a row of the final postdata array at instant T
when finish, it's assign to $data under this format: name[keyname][][]...[]='value'
@param array $data - the final data array containing all POST parameters : 1 row = 1 parameter
Recursive function formating an array in POST parameter