0

I am trying to access the values inside the array.

Sample Array $gateways

[cheque] => WC_Gateway_Cheque Object
        (
            [order_button_text] => 
            [enabled] => yes
            [title] => Check payments
            [description] => Please send a check to Store Name, Store Street, Store Town, Store State / County, Store Postcode.
            [chosen] => 
      )

foreach($gateways as $key=>$value){
            if($key->title == 'xyz'){
                unset($gateways[$key]);
                break;
            }
        }

How can I access the [title] value inside the array?

I tried $key->title.

1 Answer 1

1

Use $value->title instead of $key->title, your code would execute perfectly then. As $key indicates the key for that particular gateway and $values contains the whole object array.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.