示例#1
0
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Fonctions</title>
</head>
<body>
    <?php 
include_once "fonctionshelper.php";
$val1 = 3;
$val2 = 4;
var_dump(maFonction($val1, $val2));
var_dump(fonctionSansRetour($val1, $val2));
?>
    
</body>
</html>
示例#2
0
}
$a = 1;
while ($a <= 10) {
    echo $a . "...Bonjour<br>";
    $a = $a + 2;
}
$monTest = "Je suis le meilleur...";
function maFonction($cpt = 3, $sufixe = "Moi", $monTest)
{
    //global $monTest;
    //  $monTest = "Il est le meilleur...";
    for ($i = 0; $i < $cpt; $i++) {
        echo "Bonjour... Fonction - {$sufixe} // {$monTest}<br>";
    }
}
maFonction(3, 'toi', $monTest);
/**
 * Definition d'objet...
 */
class couteauSuisse
{
    // -> Methode
    function __construct($elements)
    {
        $this->lames = $elements;
    }
    function quellesSontMesLames()
    {
        foreach ($this->lames as $key => $value) {
            echo "Lame {$key} : {$value}<br>";
        }