Exemple d’utilisation de ‘ASSERT’

Author:

 assert
Download

<?php

    function calcul_nombre_impair($x, $y) {
        assert('!(($x % 2) && ($y % 2))');
        return ($x + $y);
    }

    $total_1 = calcul_nombre_impair(3, 5);
    $total_2 = calcul_nombre_impair(2, 4);

    echo "3 + 5 = $total_1";
    echo "2 + 4 = $total_2";

?>

Leave a Reply

Your email address will not be published. Required fields are marked *


2 + = nine