holepro Posted September 8, 2010 Share Posted September 8, 2010 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 https://forums.phpfreaks.com/topic/212918-passing-array-value-dynamically-into-another-array/ Share on other sites More sharing options...
AbraCadaver Posted September 9, 2010 Share Posted September 9, 2010 $order = $t->GetDocument($documentlist['MerchantDocumentInfo'][1]['documentID']) ; Link to comment https://forums.phpfreaks.com/topic/212918-passing-array-value-dynamically-into-another-array/#findComment-1108968 Share on other sites More sharing options...
holepro Posted September 9, 2010 Author Share Posted September 9, 2010 THANK YOU SHAWN.. this is what I needed.. really appreciate your help. Have a super evening! Link to comment https://forums.phpfreaks.com/topic/212918-passing-array-value-dynamically-into-another-array/#findComment-1108971 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.