Php debutant

laurent -  
JooS Messages postés 2705 Statut Membre -
bjr cher expert depuis deux jrs essai de trouver la reponse a ce probleme.

je declare des variable et fais une fonction ki additionne ces variables. ensuite je veux les afficher a l ecran.

mon code n affiche rien ds mon browser.

voici le code

<?php

global $checkButton1=30;
global $checkButton2=647;
global $checkButton3=1997;
global $checkButton4=247;

global $somme=0;

function calSomme(){
$somme=$checkButton1+$checkButton2+$checkButton3+$checkButton4;
return $somme;
}

function calPartAnnuelle(){
return calSomme()/12;
}

$total=calSomme();
$partition=calPartAnnuelle();

echo"<hr/>";
echo"-------------------------------------------------------------------------------------------- <br/>
Brute Net <br/>
total: ".$total." ".($total*1,19)." <br/>
partition annuelle: ".$partition." ".($partition*1,19)." <br/>
";
?>

1 réponse

  1. JooS Messages postés 2705 Statut Membre 228
     
    C'est mieux comme ça, non?? o_O
    <?php
    function calSomme($nbre1,$nbre2,$nbre3,$nbre4) {
        return $nbre1+$nbre2+$nbre3+$nbre4;
    }
    
    function calPartAnnuelle($nbre1,$nbre2,$nbre3,$nbre4){ 
    return calSomme($nbre1,$nbre2,$nbre3,$nbre4)/12; 
    }
    
    $total = calSomme(30,647,1997,247);
    $partition = calPartAnnuelle(30,647,1997,247);
    
    echo 'total '.$total.'<br>';
    echo 'part '.$partition;
    ?>
    
    0