I upload several files with Zend and want to count the $data array to get the filenames.
$data = array_merge_recursive(
$this->getRequest()->getPost()->toArray(),
$this->getRequest()->getFiles()->toArray()
);
I found this code for counting in another post
array_sum(array_map("count", $data))-1;
It gives the right amount of pieces and I can get the names, but it also gives a warning:
Warning: count(): Parameter must be an array or an object that implements Countable
I tried to give the other dimensions like:
array_sum(array_map("count", $data['fieldname']))-1;
But like expected, it doesn't work.
Any help appreciated! The only question is how to get the amount of given filenames.
***edit regarding to the answer I post a screenshot how the $data array looks like, which is correct
And here what the statement with the warning counts (of course 1 is to subtract). Perhaps there is an other possibility to count.
So everything might be nice, but I want to get rid of the warning.