title: How to get an element of an object from an array containing the object
body: <p>Here is an array which is response from Stripe payment gateway:</p>
  
  <pre><code>$response = Array ( [deleteCardAccount] =&gt; Stripe\Card Object ( [_opts:protected] =&gt; Stripe\Util\RequestOptions Object ( [headers] =&gt; Array ( ) [apiKey] =&gt; sk_test_erwppHN9ibdfgdfg0CesaOwnDy ) [_values:protected] =&gt; Array ( [id] =&gt; card_18SwerIsEZ1YjoOMVAFRLA [currency] =&gt; usd [deleted] =&gt; 1 ) [_unsavedValues:protected] =&gt; Stripe\Util\Set Object ( [_elts:Stripe\Util\Set:private] =&gt; Array ( ) ) ...
  </code></pre>
  
  <p>The above array contains the object "Stripe\Card Object" and I want to get value of the element [_values:protected] which is an array.</p>
  
  <p>When I cast the object to an array  </p>
  
  <pre><code>$nasty_array = (array)$response['deleteCardAccount'];
  print_r($nasty_array); 
  </code></pre>
  
  <p>I get this array that has keys that start with asterisk:</p>
  
  <pre><code>Array ( [*_opts] =&gt; Stripe\Util\RequestOptions Object ( [headers] =&gt; Array ( ) [apiKey] =&gt; sk_test_wejYbwerCerwesaOefg ) [*_values] =&gt; Array ( [id] =&gt; card_18SwerIsEZ1YjoOMVAFRLA [currency] =&gt; usd [deleted] =&gt; 1 ) [*_unsavedValues] =&gt; Stripe\Util\Set Object ( [_elts:Stripe\Util\Set:private] =&gt; Array ( ) ) ...
  </code></pre>
  
  <p>However when I try </p>
  
  <pre><code>print_r($nasty_array[*_opts]);
  print_r($nasty_array[*_values]);
  </code></pre>
  
  <p>I get </p>
  
  <pre><code>error: Undefined index *_values 
  error: Undefined index *_opts  
  </code></pre>
  
  <p>Questions: </p>
  
  <ol>
  <li>Why keys in this array start with asterisk</li>
  <li>How to access such keys without parsing</li>
  <li>Is there another way to get an element of an object which is inside of an associative array. </li>
  </ol>
  
  <p>Note: when I manually create an array that has keys that start with asterisk then I can access such keys without a problem, But for some reason I can't access similar keys when casting opject to an array;</p>