Jump to content

Help with an array


tqla

Recommended Posts

I have an array called $list that has many rows. There is a number in the "amount" column. How can I look through the array and count the ones that have a number higher than 0 and then echo the total.

 

In short:

Look at the array $list

Count the rows that don't have 0 in the "amount" column.

$newList = sizeof($rows-with-no-0-in-amount-column)

 

Thanks!

 

 

Link to comment
https://forums.phpfreaks.com/topic/190584-help-with-an-array/
Share on other sites

Hey Teamatomic, I can't show the results of print_r here because it's real information (and 100s of rows) but doing so I did discover that it's a multidimensional array.  I've also tried $result= array_count_values ($input_array) with a while loop and got no result. Hmmm. I guess multidimensional arrays are hard to count.

Link to comment
https://forums.phpfreaks.com/topic/190584-help-with-an-array/#findComment-1006273
Share on other sites

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.