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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.