Php debutant

Fermé
laurent - 6 mars 2011 à 12:32
JooS Messages postés 2465 Date d'inscription mardi 22 janvier 2008 Statut Membre Dernière intervention 8 juin 2016 - 6 mars 2011 à 14:57
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/>
";
?>
A voir également:

1 réponse

JooS Messages postés 2465 Date d'inscription mardi 22 janvier 2008 Statut Membre Dernière intervention 8 juin 2016 228
6 mars 2011 à 14:57
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