Have you ever tried to make a foreach loop to iterate over an array empty? Surely you’ve ever used and most likely you have a topic for the cycle manufactured by some piece of code broken, as is known, in fact, run a foreach on an array without values leads to the generation of an error, specifically talking about a error as the following:
“PHP Warning: Invalid argument supplied for foreach ()”
Like all the errors in PHP, also previously shown that it is manageable, before taking action, however, keep in mind that it is generated not only by an empty array, but also an element that is manipulated as an array though reality is not. Accepted these conditions, the solution of the problem will go for a simple operation of typecasting:
<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">foreach ((array) $array_errato as $k => $v) {</span> foreach ((array) $ array_errato as $ k => $ v) (</span>
<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">echo $k .</span> echo $ k.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">" " .</span> "."</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">$v.</span> $ V.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">"\r\n";</span> "\ R \ n";</span>
<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left;">}</span> )</span>
array will convert any array arguments are passed, so the item can be cycled though devoid of values passed as parameter.