Exemplo n.º 1
0
    {
        $totTachtig = array();
        $getal = rand(1, 100);
        array_push($totTachtig, $getal);
        while ($getal < 80) {
            $getal = rand(1, 100);
            array_push($totTachtig, $getal);
        }
        return $totTachtig;
    }
}
?>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
$getal = new getallen();
print_r($getal->tachtig());
?>
    </body>
</html>
Exemplo n.º 2
0
/*tachtig*/
class getallen
{
    public function inhoudArray()
    {
        $deArray = array();
        for ($i = 1; $i <= 50; $i += 2) {
            array_push($deArray, $i);
        }
        for ($i = 2; $i <= 50; $i += 2) {
            array_push($deArray, $i);
        }
        return $deArray;
    }
}
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
$getal = new getallen();
print_r($getal->inhoudArray());
?>
    </body>
</html>