1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
| <?php
function bouclier($PArestant, $PAtot)
{
$jumbocy=0;
$cymin=0;
$PL=0;
$Moz=0;
$a=($PArestant/10 - (int) ($PArestant/10))*10;
if ($a==0)
{
$cymin = (int) ($PArestant/10);
$PArestant=$PArestant-10*$cymin;
if($PArestant!=0)
{
echo"Erreur PA full cymin GVG. ";
}
else
{
echo"full cymin réussis ($cymin)";
}
}
else if ($a>=1 AND $a<=4)
{
$PL=$a;
if($PL*31>$PArestant)
{
echo"$PL*31 > $PArestant<br>";
$PL=(int) ($PArestant/31);
$PArestant=$PArestant-31*$PL;
$cymin=(int) ($PArestant/10);
$PArestant=$PArestant-10*$cymin;
if($PArestant==0)
{
echo"Erreur, anomalie de PA restant (PL1).";
}
else
{
echo"PL1 réussis! ($PL $cymin)<br>";
}
}
else
{
$PArestant=$PArestant-31*$PL;
$cymin=(int) ($PArestant/10);
$PArestant=$PArestant-10*$cymin;
if($PArestant!=0)
{
echo"Erreur, anomalie de PA restant 2 (PL2).";
}
else
{
echo"PL2 réussis! ($PL $cymin)<br>";
}
}
}
else if ($a>= 5 AND $a<=9)
{
$Moz=10-$a;
if(($Moz*29) > ($PArestant))
{
$Moz=(int) ($PArestant/29);
$PArestant=$PArestant-29*$Moz;
$cymin=(int) ($PArestant/10);
$PArestant=$PArestant-10*$cymin;
if($PArestant==0)
{
echo"Erreur, anomalie de PA restant (Moz1).";
}
else
{
echo"Moz1 reussis! ($Moz $cymin)<br>";
}
}
else
{
$PArestant=$PArestant-29*$Moz;
$cymin=(int) ($PArestant/10);
echo"PArestant = $PArestant - 10 * $cymin <br>";
$PArestant=$PArestant-10*$cymin;
echo"pa restant3 : $PArestant<br>";
if($PArestant!=0)
{
echo"Erreur, anomalie de PA restant 2 (Moz2).";
}
else
{
echo"Moz2 reussis! ($Moz $cymin)<br>";
}
}
}
else
{
echo"Erreur bouclier GVG (a=$a)";
}
}
echo"PA restant 30, PA totaux 50<br>"; //cymin
$test3150=bouclier(30,50);
echo $test3050;
echo "<br><br>";
echo"PA restant 32, PA totaux 50<br>"; //PL1
$test3150=bouclier(32,50);
echo $test3250;
echo "<br><br>";
echo"PA restant 31, PA totaux 50<br>"; //PL2
$test3150=bouclier(31,50);
echo $test3150;
echo "<br><br>";
echo"PA restant 65, PA totaux 80<br>"; // Moz1
$test6580=bouclier(65,80);
echo $test88120;
echo "<br><br>";
echo"PA restant 88, PA totaux 120<br>"; // Moz2
$test88120=bouclier(88,120);
echo $test88120;
echo"<br><br>";
?> |
Partager