Converting Object Into an Array Based on Specific Key with PHP
<p>I'm quite new to PHP and I'm struggling converting an object into an array so that I can use that array in my code further down the line.</p>

<p>My script retrieves product data from the Magento API which shows as the following result after using <code>print_r</code> on the result variable:</p>

<p><a href="https://i.stack.imgur.com/Ern4B.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ern4B.png" alt="enter image description here"></a></p>

<p>Now I can see that this begins with "array" but when I try to use echo on the variable that I have assigned the result to, I receive the error <code>Catchable fatal error: Object of class stdClass could not be converted to string</code>.</p>

<p>How can I convert the object to an array and then split the array so that I have the values of all of the <code>sku</code> keys as an array as my eventual result?</p>

<p>I've tried using <code>array()</code> on the result variable and then attempted to manipulate it using array functions but no matter what I try I am receiving errors, so my thought is that I am not understanding this correctly.</p>

<p>Thank you for any insight that you can offer. My code is below if you need to see it:</p>

<pre><code>&lt;?php
    // Global variables.
    $client = new SoapClient('xxx'); // Magento API URL.
    $session_id = $client-&gt;login('xxx', 'xxx'); // API Username and API Key.

    // Filter where the 'FMA Stock' attribute is set to 'Yes'.
    $fma_stock_filter = array('complex_filter'=&gt;
        array(
            array('key'=&gt;'fma_stock', 'value'=&gt;array('key' =&gt;'eq', 'value' =&gt; 'Yes')),
        ),
    );

    // Assign the list of products to $zoey_product_list.
    $zoey_product_list = $client-&gt;catalogProductList($session_id, $fma_stock_filter);

    echo $zoey_product_list[0];
?&gt;
</code></pre>