title: Warning: Illegal string offset PHP 7 foreach
body: <p>Using php curl. I'm getting an array of data. From which I want to get the following data</p>
  
  <pre><code>if(is_array($jsonRes['prod']['ret']['ProdIt'])){
      foreach($jsonRes['prod']['ret']['ProdIt'] as $obRes){
          $arP["ARTI"] = $obRes['Article'];
          $arP["ALT"] = $obRes['Name'];
          $arP["BR"] = $obRes['Brand'];
  </code></pre>
  
  <p>I'm getting an error:</p>
  
  <p>Warning: Illegal string offset 'Article' in /........php on line 48</p>
  
  <p>Warning: Illegal string offset 'Name' in /...........php on line 49</p>
  
  <p>Warning: Illegal string offset 'Brand' in /...........php on line 50</p>
  
  <p>Here is an array</p>
  
  <pre><code>Array
  (
      [ret] =&gt; Array
          (
              [ProductsItemCount] =&gt; 1
              [ProdIt] =&gt; Array
                  (
                      [Code] =&gt; 0789087
                      [Article] =&gt; 3011317
                      [Name] =&gt; Price cash
                      [Brand] =&gt; HATTAT
                      [Price] =&gt; 0
                      [Currency] =&gt; EUR
                      [Stock] =&gt; Array
                          (
                              [StockItem] =&gt; Array
  </code></pre>
  
  <p>The error does not always occur. When an array looks like this, then it has no errors</p>
  
  <pre><code>Array
  (
      [ret] =&gt; Array
          (
              [ProductsItemCount] =&gt; 2
              [ProdIt] =&gt; Array
                  (
                      [0] =&gt; Array
                          (
                              [Code] =&gt; 908877677
                              [Article] =&gt; 8200892104
                              [Name] =&gt; Tovare
                              [Brand] =&gt; RENAULT
                              [Price] =&gt; 0
                              [Currency] =&gt; EUR
                              [Stock] =&gt; Array
  </code></pre>