Hey so I am a complete newbie and am taking a course to teach me php. I was given some practice problems to do but I was not given any answers to see if my work was correct. Can anyone check my work and/or give me some tips or answers to these problems? I would greatly appreciate it.
Assume that an array named $list is given to you. It contains ten numbers in cells 0 through 9. Some of the numbers are negative. You don't need to waste time writing the code to create $list. Assume it exists already. It might not contain the same numbers as the example below. Write a small piece of code including a 'for' loop that would add up all the numbers in the $list which are greater than or equal to 4, and then print "The sum of biggies is ", followed by the sum. For instance, if the list is (8, 1, 7, -7, 2, 4, 5, -14, 0, 1) then the sum of the biggies is 24. Your code will also print out "There were $n zeros and $m biggies.", where $n is replaced by the number of zeros found in the list, and $m is the number of values greater than or equal to 4. In our example, it would print “There were 1 zeros and 4 biggies.”
#list=array(8,1,7,-7,2,4,5,-14,0,1)
$for ($i=0;$i<10;$i++)
{
$x=$list[$i];
if ($x>4)
{
$total=$total+$x;
$biggies++;//biggies=$biggies+1;
}
else if ($x==0)
{
$zeros++;
]
print "The sum of biggies is $biggies
That is where I got stuck, I didn't really get the second part ><