title: convert array into .txt file
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3933668/convert-array-into-csv">Convert array into csv</a>  </p>
  </blockquote>
  
  
  
  <p>Hi,</p>
  
  <p>How to convert array into .txt file?</p>
  
  <p>This is my array:</p>
  
  <pre><code>Array
  (
      [OrderList_RetrieveByContactResult] =&gt; Array
          (
              [OrderDetails] =&gt; Array
                  (
                      [0] =&gt; Array
                          (
                              [entityId] =&gt; 156456
                              [orderId] =&gt; 110631
                              [orderName] =&gt; testing2
                              [statusTypeId] =&gt; 15656
                              [countryCode] =&gt; AU
                              [orderType] =&gt; 2
                              [invoiceNumber] =&gt; 1001
                              [invoiceDate] =&gt; 2010-10-19T00:00:00
                              [userID_AssignedTo] =&gt; 245454
                              [shippingAmount] =&gt; 8.95
                              [shippingTaxRate] =&gt; 0
                              [shippingAttention] =&gt; tttesst
                              [shippingInstructions] =&gt; this a test
                              [shippingOptionId] =&gt; 50161
                              [discountCodeId] =&gt; 0
                              [discountRate] =&gt; 0
                              [totalOrderAmount] =&gt; 143.8
                              [directDebitTypeId] =&gt; 0
                              [directDebitDays] =&gt; 0
                              [isRecur] =&gt; 
                              [nextInvoiceDate] =&gt; 0001-01-01T00:00:00
                              [endRecurDate] =&gt; 0001-01-01T00:00:00
                              [cycleTypeID] =&gt; 1
                              [createDate] =&gt; 2010-10-19T05:40:00
                              [lastUpdateDate] =&gt; 2010-10-19T05:40:00
                              [deleted] =&gt; 
                              [products] =&gt; Array
                                  (
                                      [Product] =&gt; Array
                                          (
                                              [productId] =&gt; 455
                                              [productCode] =&gt; 
                                              [productDescription] =&gt; testtest
                                              [units] =&gt; 3
                                              [unitPrice] =&gt; 44.95
                                              [unitTaxRate] =&gt; 0
                                              [totalProductPrice] =&gt; 134.85
                                              [productName] =&gt; Skin Support Tablets
                                          )
                                  )
  
                              [addresses] =&gt; Array
                                  (
                                      [Address] =&gt; Array
                                          (
                                              [addressTypeID] =&gt; 8
                                              [addressLine1] =&gt; Cebu
                                              [city] =&gt; City
                                              [zipcode] =&gt; 6000
                                              [state] =&gt; cebu
                                              [countryCode] =&gt; PH
                                          )
                                  )
  
                          )
  
                      [1] =&gt; Array
                          (
                              [entityId] =&gt; 315456
                              [orderId] =&gt; 321321
                              [orderName] =&gt; testing
                              [statusTypeId] =&gt; 3213
                              [countryCode] =&gt; AU
                              [orderType] =&gt; 2
                              [invoiceNumber] =&gt; 1002
                              [invoiceDate] =&gt; 2010-10-19T00:00:00
                              [userID_AssignedTo] =&gt; 11711
                              [shippingAmount] =&gt; 8.95
                              [shippingTaxRate] =&gt; 0
                              [shippingAttention] =&gt; 
                              [shippingInstructions] =&gt; 
                              [shippingOptionId] =&gt; 50161
                              [discountCodeId] =&gt; 0
                              [discountRate] =&gt; 0
                              [totalOrderAmount] =&gt; 408.45
                              [directDebitTypeId] =&gt; 0
                              [directDebitDays] =&gt; 0
                              [isRecur] =&gt; 
                              [nextInvoiceDate] =&gt; 0001-01-01T00:00:00
                              [endRecurDate] =&gt; 0001-01-01T00:00:00
                              [cycleTypeID] =&gt; 1
                              [createDate] =&gt; 2010-10-08T18:40:00
                              [lastUpdateDate] =&gt; 2010-10-19T18:36:00
                              [deleted] =&gt; 
                              [products] =&gt; Array
                                  (
                                      [Product] =&gt; Array
                                          (
                                              [productId] =&gt; 11564
                                              [productCode] =&gt; 
                                              [productDescription] =&gt; 
                                              [units] =&gt; 10
                                              [unitPrice] =&gt; 39.95
                                              [unitTaxRate] =&gt; 0
                                              [totalProductPrice] =&gt; 399.5
                                              [productName] =&gt; Acne Clearing Gel
                                          )
  
                                  )
  
                              [addresses] =&gt; Array
                                  (
                                      [Address] =&gt; Array
                                          (
                                              [addressTypeID] =&gt; 8
                                              [addressLine1] =&gt; Cebu City
                                              [city] =&gt; Cebu
                                              [zipcode] =&gt; 6000
                                              [state] =&gt; 
                                              [countryCode] =&gt; PH
                                          )
  
                                  )
  
                          )
  
                  )
  
          )
  
  )
  </code></pre>