Jump to content

Passing array value dynamically into another array


holepro

Recommended Posts

Given the following array  $documentlist, displayed from print_r

 

Array

(

    [MerchantDocumentInfo] => Array

        (

            [0] => Array

                (

                    [documentID] => 2760322451

                    [generatedDateTime] => 2010-08-03T16:02:45-07:00

                )

 

            [1] => Array

                (

                    [documentID] => 2761837402

                    [generatedDateTime] => 2010-08-03T23:01:15-07:00

                )

 

        )

)

 

 

I'm trying to figure out the syntax to use the documentID as a dynamic variable

 

When I 'hard code' the variable, I get the document I want

 

eg  $order = $t->GetDocument('2760322451'); -- returns requested document info into $order array

 

where $order is an array and  $t are my connection credentials.

 

I've made numerous attempts, but get errors in anything I try.

 

Can someone tell me the correct syntax to use to pass a dynamic value for documentID from the $documentlist array at the top?

 

I've tried

 

$order = $t->GetDocument($documentlist['MerchantDocumentInfo'[0]]['documentID']) ;

 

and get ===>  syntax error, unexpected '[', expecting ']'

 

$order = $t->GetDocument($documentlist->MerchantDocumentInfo[0]['documentID']) ;

 

get nothing

 

$order = $t->GetDocument($documentlist->MerchantDocumentInfo[1]['documentID']) ;

 

get nothing

 

$order = $t->GetDocument($documentlist->MerchantDocumentInfo[1][documentID]) ;

 

get nothing

 

 

Thanks in advance for any ideas, I've been trying to figure this out for days.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.