Skip to content
Snippets Groups Projects
Commit 4c2e4a1d authored by Sofiane Lasri's avatar Sofiane Lasri
Browse files

TP1 terminé.

parent 92f42553
Branches
No related tags found
Loading
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="PublishConfigData" autoUpload="Always" serverName="VPS 1" remoteFilesAllowedToDisappearOnAutoupload="false" autoUploadExternalChanges="true"> <component name="PublishConfigData" autoUpload="Always" serverName="VPS 1" autoUploadExternalChanges="true">
<serverData> <serverData>
<paths name="VPS 1"> <paths name="VPS 1">
<serverdata> <serverdata>
......
<?php
$capital = array(10000);
for ($i=0; $i<10; $i++){
echo "<br>$i: " . $capital[$i];
$capital[$i+1] = floor($capital[$i] * 1.05);
}
\ No newline at end of file
<?php
$atteindre = 18000;
$init = 10000;
$taux = 1.05;
$total = $init;
$nbAnnees = 0;
while($total < $atteindre){
$total *= $taux;
$nbAnnees++;
}
?>
<h1>Dépassement d'un seuil donné</h1>
<p>Seuil à atteindre : <?=$atteindre?></p>
<p>Captial Intial : <?=$init?></p>
<p>Taux d'intérêt : <?php echo ($taux - 1) * 100; ?> %</p>
<p>Capital en début d'année <?=$nbAnnees?> : <?=$total?></p>
<?php
if(isset($_GET['seuil'])){
$atteindre = $_GET['seuil'];
}else{
$atteindre = 18000;
}
if(isset($_GET['capitalInitial'])){
$init = $_GET['capitalInitial'];
}else{
$init = 10000;
}
if(isset($_GET['taux'])){
$taux = $_GET['taux']/100 + 1;
}else{
$taux = 1.05;
}
$total = $init;
$nbAnnees = 0;
while($total < $atteindre){
$total *= $taux;
$nbAnnees++;
}
?>
<h1>Dépassement d'un seuil donné</h1>
<p>Seuil à atteindre : <?=$atteindre?></p>
<p>Captial Intial : <?=$init?></p>
<p>Taux d'intérêt : <?php echo ($taux - 1) * 100; ?> %</p>
<p>Capital en début d'année <?=$nbAnnees?> : <?=$total?></p>
\ No newline at end of file
<?php
if(isset($_GET['seuil'])){
$atteindre = $_GET['seuil'];
}else{
$atteindre = 18000;
}
if(isset($_GET['capitalInitial'])){
$init = $_GET['capitalInitial'];
}else{
$init = 10000;
}
if(isset($_GET['targetYears'])){
$targetYears = $_GET['targetYears'];
}else{
$targetYears = 10;
}
$taux = ($atteindre - $init) / $targetYears;
$total = $init;
$nbAnnees = 0;
while($total < $atteindre){
$total *= $taux;
$nbAnnees++;
}
?>
<h1>Dépassement d'un seuil donné</h1>
<p>Seuil à atteindre : <?=$atteindre?></p>
<p>Captial Intial : <?=$init?></p>
<p>Taux d'intérêt pour <?=$targetYears?> année(s) : <?php echo ($taux - 1) * 100; ?> %</p>
<p>Capital en début d'année <?=$nbAnnees?> : <?=$total?></p>
\ No newline at end of file
<h1>Affichage de $_GET</h1>
<?php
echo "<pre>"; print_r($_GET); echo "</pre>";
?>
<h1>Affichage des index de $_GET</h1>
<?php
echo "<pre>"; print_r(array_keys($_GET)); echo "</pre>";
echo "<h1>Détection des clés prenom et nom</Affi></h1>";
if(array_key_exists("prenom", $_GET)){
echo "Prénom: " . $_GET['prenom'];
}
if(array_key_exists("nom", $_GET)){
echo "<br>Nom: " . $_GET['nom'];
}
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment