How can I read a json array in PHP : <p>I have this array that I read (using curl) in PHP
it returns a string that looks like a json so I convert it into a real json.</p>

<p>But what ever I do to read it, does not work:</p>

<p>what am I doing wrong and how can I reach those values?</p>

<p><strong>This is the result that I get:</strong></p>

<pre><code>Array
(
    [results] =&gt; Array
        (
            [1] =&gt; Array
                (
                    [pack_id] =&gt; HUJoUJKK673ED
                    [imre] =&gt; 87687548574
                    [imrd] =&gt; 87457654764
                    [cell_id] =&gt; 775443
                    [firm_vrs] =&gt; 2
                    [gg_yr] =&gt; 2017
                    [gg_mn] =&gt; 3
                    [gg_dy] =&gt; 20
                    [gg_hr] =&gt; 15
</code></pre>

<p><strong>This is my code</strong>    </p>

<pre><code>&lt;?php
    $url = $_GET["url"];
    $curlSession = curl_init();
    curl_setopt($curlSession, CURLOPT_URL, $url);
    curl_setopt($curlSession, CURLOPT_BINARYTRANSFER, true);
    curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);
    $returnVal = curl_exec($curlSession);
    curl_close($curlSession);

    //converting the retreived "json lookalike text" in to a json:
    $decodedText = html_entity_decode($returnVal);
    $myArray = json_decode($decodedText, true);

    //this DOES work and shows the json as an array, as described above.
    echo "&lt;pre&gt;";
    print_r($myArray);
    echo "&lt;/pre&gt;";

    //BUT non of the following lines work:
    $echo = sizeof($myArray-&gt;results);
    echo "&lt;br /&gt;".$myArray-&gt;results[1]-&gt;imre;
    echo "&lt;br /&gt;".sizeof($myArray);
    echo "&lt;br /&gt;".sizeof($myArray-&gt;results);
    echo "&lt;br /&gt;".sizeof($myArray-&gt;results[1]);
    echo "&lt;br /&gt;".sizeof($myArray[1][1]);
    echo "&lt;br /&gt;".sizeof($myArray[0]);
    echo "&lt;br /&gt;".sizeof($myArray[0]-&gt;results);
    echo "&lt;br /&gt;".sizeof($myArray-&gt;imre);
    echo "&lt;br /&gt;".sizeof($myArray[0]-&gt;results);
    echo "&lt;br /&gt;".$myArray-&gt;results['1']-&gt;imre;
    echo "&lt;br /&gt;".$myArray[0]-&gt;results[1]-&gt;imre;
    echo "&lt;br /&gt;".$myArray-&gt;results[1]-&gt;imre;
    echo "&lt;br /&gt;".sizeof($myArray-&gt;results[1]);
?&gt;
</code></pre>
