Hi, I have an array that looks like the following:
The format:
[Person#] => Array
(
[Bank#] => Balance
.
.
[Bank#] => Balance
)
The Array:
[1] => Array
(
[0] => 707 //Person #1 has 707 balance in Bank #0
[1] => 472 //Person #1 has 472 balance in Bank #1
)
[2] => Array
(
[0] => 2614
[3] => 140
[1] => 2802
[4] => 245
[2] => 0 //Person #2 has 0 balance in Bank #2
)
[3] => Array
(
[2] => 0
[3] => 0
[0] => 1710
[4] => 0
[1] => 575
)
[4] => Array
(
[1] => 1105
[0] => 1010
[4] => 0
[3] => 120
[2] => 0
)
[5] => Array
(
[1] => 238
[4] => 0
[0] => 0
)
[6] => Array
(
[0] => 850
[1] => 0
)
[7] => Array
(
[4] => 500
[0] => 3397
[1] => 2837
)
The number to the left of the word "Array" represents a person. The first single digit number represents a bank. The second number represents a balance in the bank.
I'm printing these numbers out in a table and, as you'll see in this example, Bank #2 has a zero balance for all people who have an account with Bank #2. I need a way to remove Bank #2 from the array -- and/or recreate the array without Bank #2. Of course, it won't always be Bank #2 that needs to be removed so it has to be a solution that finds any Banks with a total balance of zero (across all people) and removes it.
Alternatively, I am fine with removing all zero balances from the array before going to print out the table.
I'm not sure which is easier as I haven't been able to find a simple way to do either one.