Accessing Element from a Multi-dimensional Array with php
<p>I have an array of data in the format below and I find it hard accessing the elements especially the "data" array with php.</p>

<pre><code>Array ( 
[jsonrpc] =&gt; 2.0 
[result] =&gt; Array ( 
    [random] =&gt; Array ( 
        [data] =&gt; Array ( 
            [0] =&gt; 15 
            [1] =&gt; 36 
            [2] =&gt; 11 
            [3] =&gt; 2 
            [4] =&gt; 31 
            [5] =&gt; 16 
            [6] =&gt; 19 
            [7] =&gt; 50 
            [8] =&gt; 24 
            [9] =&gt; 33 
            [10] =&gt; 3 
            [11] =&gt; 46 
            [12] =&gt; 37 
            [13] =&gt; 7 
            [14] =&gt; 29 
            [15] =&gt; 13 
            [16] =&gt; 52 
            [17] =&gt; 14 
            [18] =&gt; 49 
            [19] =&gt; 42 
            [20] =&gt; 40 
            [21] =&gt; 25 
            [22] =&gt; 39 
            [23] =&gt; 21 
            [24] =&gt; 28 
            [25] =&gt; 27 
            [26] =&gt; 34 
            [27] =&gt; 8 
            [28] =&gt; 10 
            [29] =&gt; 41 
            [30] =&gt; 45 
            [31] =&gt; 47 
            [32] =&gt; 26 
            [33] =&gt; 20 
            [34] =&gt; 12 
            [35] =&gt; 9 
            [36] =&gt; 6 
            [37] =&gt; 32 
            [38] =&gt; 18 
            [39] =&gt; 17 
            [40] =&gt; 38 
            [41] =&gt; 23 
            [42] =&gt; 5 
            [43] =&gt; 51 
            [44] =&gt; 35 
            [45] =&gt; 43 
            [46] =&gt; 44 
            [47] =&gt; 30 
            [48] =&gt; 48 
            [49] =&gt; 4 
            [50] =&gt; 1 
            [51] =&gt; 22 
                        ) 
        [completionTime] =&gt; 2016-01-22 11:11:26Z 
                    ) 
        [bitsUsed] =&gt; 296 
        [bitsLeft] =&gt; 933024 
        [requestsLeft] =&gt; 197725 
        [advisoryDelay] =&gt; 70 
                ) 
        [id] =&gt; 16083686 )
</code></pre>

<p>I have tried</p>

<pre><code>echo $myArray['data'];
</code></pre>

<p>but I got error <strong>Undefined index: data</strong></p>

<p>I have also tried the foreach function</p>

<pre><code>foreach ($myArray as $row){
 echo $row['result']['random']['data'];
}
</code></pre>

<p>but I get error <strong>Illegal string offset 'result'</strong> </p>

<p>I've had my time with this and would be very glad to get help with accessing the elements in this array.</p>