Hey All,
Im trying to extract info from an array and format it specific order.
The arrays are being generated from the backend and are dynamic, an example would be as follows:
Array ( [0] => 128 [1] => 265 [2] => 225 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 )
Another example would be
Array ( [0] => 32 [1] => 546 [2] => 183 [3] => 962 [4] => 111 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 )
Basically what i want to do is only extract the ones that arent 0 and then place a comma between them, and before the last one have a &
So for example, if there were only 2 values in the array that didnt equal zero, the output would be
132 & 435
or another example if there were more than 2 values that didnt equal zero
132, 435, 940, 345 & 235
Im really stumped on this, any help would be greatly appreaciated.
Cheers,