I have 20 items in my foreach statement. I have been added counter using $index = 0; $index++
$index = 0;
foreach( $partialStructure as $map ) {
// i am getting specific number of $tmp for specific subject ( member )
$tmp = $this->getFieldValueString($field, $value, $subject, $map, $partialStructure);
$array = array(
$index => $index,
);
if(count($array) < 20) {
// redirect
} else {
// do nothing
}
$index++;
}
In my case, i want to redirect member to another page if there are not 20 items. But when i check ['20'] and setup else, other 1 to 19 are still there, and redirect are going also if member have ['20'] exist.
How i can make it happend, if member have 20 items to dont redirect, and if there is less then 20 items to redirect?
Thanks !
$index = count($partialStructure); $array = array($index => $index);$partialStructurevariable likecount($partialStructure) < 20