Question: A1 A2 A3 A4 table { border-spacing: 2em 3em; border-collapse: separate; } td { border-right: solid 1px black; border-left: solid 1px black; } Only output
| $a1 = [10.001, 11.591, 0.011, 5.991, 16.121, 0.131, 100.981, 1.001]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| $a2 = [1.99, 1.99, 0.99, 1.99, 0.99, 1.99, 0.99, 0.99]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| $a3 = [0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| $a4 = [10.01, -12.22, 0.23, 19.20, -5.13, 3.12]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| function getTotal($arr) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
echo " Processing Array: " . var_export($arr, true) . ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| $total = 0.00; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| //TODO do adding here | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| //TODO do rounding stuff here | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "The total is " . var_export($total, true); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Problem 2: Adding Floats "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| ?> | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| table { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| border-spacing: 2em 3em; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| border-collapse: separate; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| td { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| border-right: solid 1px black; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| border-left: solid 1px black; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
Only output the sum/total of the array values by assigning it to the $total variable (the number must end in 2 decimal places, if it ends in 1 it must have a 0 at the end)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
