Code example:
$list = array( array('name' => 'test'), array('name' => ''), array('name' => 'test2') ); echo 'В этом списке N элементов:<br>'; $i = 0; foreach ($list as $el){ if(empty($el['name'])) continue; echo ++$i.') '.$el['name'].'<br>'; } echo 'Вот это значение нужно вывести в место "N" до списка: '.$i; Result:
How to correctly display this value before it is even calculated?
Just prepare the array in advance, sorting it out and output the array length (will you have to iterate over the array twice) or are there more correct solutions?
