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
|
<?php
print ("<form action=\"\" method=\"get\ action=\"http:\/\/creatif-web.be\/video\/essai.php\">
<input name=\"letemps\" type=\"text\" />
<input type=\"button\" value=\"envoie\" />
</form>");
//$temps='d-m-y, H:i:s';
$tempsForm=$_GET['letemps'];
$point=".";
if( strcspn($tempsForm, $point) == strlen($tempsForm)) {
$sec=$_GET['letemps'] * 60;
echo "<p>".$_GET['letemps']. " minute(s) équivaux à <span class=\"red\">" .$sec. "</span> seconde</p>.";
// test pour un format entier
}
else {
$decim=substr($_GET['letemps'], 2, 2);
$entier=substr($_GET['letemps'], 0, 1);
$sec=$entier * 60 + $decim;
echo "<p>".$_GET['letemps']." minute équivaux à <span class=\"red\">" .$sec. "</span> seconde</p>.";
// test pour un format 8; 14; 4.1; 6.32
}
/*else {
$deuxDec=substr("$_GET[letemps]", 0, 1);
$plutot=$deuxDec * 60;
$deuxder=substr("$_GET[letemps]", 3, 2);
$deuxChiffres=$plutot + $deuxder;
echo "<br /><br />".$deuxChiffres;
// test pour un format 10.2; 10.23
}
*/
?> |
Partager