Jump to content

Is there something wrong?


dyluck

Recommended Posts

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

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++;

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.