0

I've got an array like this:

Array (
  [0] => Mollie_Response Object (
     [@attributes] => Array ( [version] => v1 ) 
     [success] => true 
     [resultcode] => 10 
     [resultmessage] => Customer has the following payment methodes. 
     [services] => Mollie_Response Object ( 
        [ivr] => true 
        [minitix] => true 
        [psms] => true 
        [ideal] => true 
        [paysafecard] => false
     )
   )
 )

I want to get the value of [ideal] but I don't know how to do this.

What i've tried is this:

$response = $simplexml;

foreach( $response as $value ) 
{
    echo 'Test: '.$value[0].'<br>';
}

Response is this:

Test: true
Test: 10
Test: Customer has the following payment methodes.
Test: 

Any suggestions?

2 Answers 2

5

That would be something like:

$variable[0]->services->ideal
Sign up to request clarification or add additional context in comments.

Comments

1

I think identation helps a lot to check the fields:

Array ( [0] => 
  Mollie_Response Object ( 
      [@attributes] => Array ( [version] => v1 ) 
      [success] => true 
      [resultcode] => 10 
      [resultmessage] => Customer has the following payment methodes. 
      [services] => Mollie_Response Object ( 
          [ivr] => true 
          [minitix] => true 
          [psms] => true 
          [ideal] => true 
          [paysafecard] => false 
      )
  )
)

So now it is clear that you need to use $response[0]->services->ideal.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.