View Full Version : counting array
nastynappy
Jan 28th 2008, 7:40 am
can anyone please tell me what does this script do ??
if($child['cat_id'] != $child['cat_parent']) {
$count = count($child)-1;
for ($i = 0; $i < $count; $i++) {
if ($i == 0) {
$ii[] = $i;
}
}
$iii = count($ii);
if ($count == $iii) {
$add = ' ';
}
else {
$add = '|';
}
}
please?
CreativeClans
Jan 28th 2008, 7:48 am
if($child['cat_id'] != $child['cat_parent']) {
$count = count($child)-1;
for ($i = 0; $i < $count; $i++) {
if ($i == 0) {
$ii[] = $i;
}
}
$iii = count($ii);
if ($count == $iii) {
$add = ' ';
}
else {
$add = '|';
}
}
Indented like this, it's a bit easier to read. But still, I have no idea what it's for :confused:
nastynappy
Jan 28th 2008, 7:58 am
it is for counting the number of names echoed in <option> collected from mysql database's table.
i can understand the first part, but not rest of it.
i can see it is:
if $child['cat_id'] isnt $child['cat_parent'] (which means, if the current echoed name isnt a parent) then do the rest of code.. which is the part i cant understand.
so, can anyone help me ??
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.