dyluck Posted January 10, 2010 Share Posted January 10, 2010 Hi all, Just a quick question... can someone look at this code and see if something is wrong? $j = 1; $vals = array(); $feedline = array(); foreach(explode($delimiter,$b) as $key => $values) { if($j == $appsubcol2 || $j == $appsubcol3 || $j == $appsubcol4) { $x = 1; if(!empty($delimet2) && $j == $appsubcol2) {$del = $sdelimiter; $sdel = $sdel2; } if(!empty($delimet3) && $j == $appsubcol3) {$del = $ssdelimiter; $sdel = $sdel3; } if(!empty($delimet4) && $j == $appsubcol4) {$del = $sssdelimiter; $sdel = $sdel4; } $subcount = count(explode($del,$values)); foreach(explode($del,$values) as $subdel) { if($sdel[$x] == 1) { $feedline[$j] = $subdel; $j++; } $x++; }} else { $feedline[$j] = $values; $j++; } } The first itteration of the three if statments works great... when it gets to the second and third if statement, they don't explode.... Thanks Link to comment https://forums.phpfreaks.com/topic/187978-is-there-something-wrong/ Share on other sites More sharing options...
dyluck Posted January 10, 2010 Author Share Posted January 10, 2010 nevermind, I figured it out :S It needed to look like: $j = 1; $n = 1; $vals = array(); $feedline = array(); foreach(explode($delimiter,$b) as $key => $values) { if($n == $appsubcol2 || $n== $appsubcol3 || $n == $appsubcol4) { $x = 1; if(!empty($delimet2) && $n == $appsubcol2) {$del = $sdelimiter; $sdel = $sdel2; } if(!empty($delimet3) && $n == $appsubcol3) {$del = $ssdelimiter; $sdel = $sdel3; } if(!empty($delimet4) && $n == $appsubcol4) {$del = $sssdelimiter; $sdel = $sdel4; } $subcount = count(explode($del,$values)); foreach(explode($del,$values) as $subdel) { if($sdel[$x] == 1) { $feedline[$j] = $subdel; $j++; } $x++; }} else { $feedline[$j] = $values; $j++; } $n++; } Link to comment https://forums.phpfreaks.com/topic/187978-is-there-something-wrong/#findComment-992430 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.