php - Invalid argument for foreach() -


The error I'm receiving is the invalid argument given for foreach ()

the offending part is :

  foreach ($ subs [$ id] $ id2 => $ data2)  

Strange reason I use the same build Somewhere else and it works okay .. I am using it to create sub categories and it works, but I am getting rid of the error.

This is more context.

  foreach ($ parents $ id = & gt; $ as data A.) {if ($ x == 0) {$ html = "& lt; tr width = '25% 'class =' ​​Line 2 '& gt;"; } $ Shtml = ""; $ I = 0; *** foreach ($ subs [$ id] $ id2 = & gt; $ data2) *** {$ i ++; If ($ i == 15) {$ shtml = $ this-> Ipsclass-> Compiled_templus ['skin_business'] - & gt; Portal_greyz_sub_o ($ id2, $ data2 ['cat_name'], 1). ""; break; } And $ shtml = $ This- & gt; Ipsclass-> Compiled_templus ['skin_business'] - & gt; Portal_cales_sub_urrow ($ id2, $ data2 ['cat_name'], 0). ""; }  $ subs [$ id]  

Code> is not an array continuously, this is $ subs [0] can be an array, but $ subs [1] is a scaler.

An array of it:

  foreach ($ array) $ subs [$ id] $ id2 = & gt; $ Data2)  

If the $ subs [1] is a scaler, then casting it to the aim of it as a temporary array of element Is made in the form.


Comments