# Need help with homework, beginner

``````
// create a php script that lists out all the numbers that are divisible of 3 up to 100
//for løkke

for (\$teller=3;\$teller<100;\$teller+=3) {
echo \$teller." ";
}

//Do the same with an while loop

//while løkke

\$teller=3;
while(\$teller<100){
echo "\$teller ";\$teller+=3;
}

//find the average of the numbers (3-100)

\$alleTall=array(3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99);//gjennomsnitt av tallene
echo array_sum(\$alleTall)/count(\$alleTall);

//Numbers above 5

\$liste = array(1,4,8,1,4,10,5,6,2,4,6); //lister ut tallene som er feme ller over. Usikker på om jeg skulle ta med fem eller ikke.
echo \$liste[2]." ";
echo \$liste[5]." ";
echo \$liste[6]." ";
echo \$liste[7]." ";
echo \$liste[10]." ";

//count up how many numbers that are above  5 and show this

function hoyere_enn(\$arg){
return \$arg > 5;}

\$nummere = array(1,4,8,1,4,10,5,6,2,4,6);
\$filter = array_filter(\$nummere, 'hoyere_enn');
print_r(\$filter);

// Print array backwards

\$liste1 = array(1,4,8,1,4,10,5,6,2,4,6);
\$listeBaklengs = implode(" ", array_reverse(\$liste1));
echo \$listeBaklengs;

// Smallest number in the array.

\$minste=array(1,4,8,1,4,10,5,6,2,4,6);
echo min(\$minste);
``````

The language in the coding is Norwegian, tell me if you need me to translate. I hope someone can help me with this, im pretty new to PHP. This is my first homework.

Thanks

For Q1 go and read the manual page on [fphp]range/fphp;

Come back with a working example, or your best attempt at it and some evidence you have tried something.

Incidentally, if this is your homework assignment, why is it in a language you cant understand?

Are you asking us to validate your assignment or to help you out with an issue in your assignment? As it looks like you did what was requested albeit the only one that looks wrong is

``````        //Numbers above 5

\$liste = array(1,4,8,1,4,10,5,6,2,4,6); //lister ut tallene som er feme ller over. Usikker på om jeg skulle ta med fem eller ikke.
echo \$liste[2]." ";
echo \$liste[5]." ";
echo \$liste[6]." ";
echo \$liste[7]." ";
echo \$liste[10]." ";
``````

There are better ways to implement that.