Ajouter texte nombres y + 1 = y1
Résolu/Fermé
A voir également:
- Ajouter texte nombres y + 1 = y1
- Excel cellule couleur si condition texte - Guide
- Transcription audio en texte word gratuit - Guide
- Ajouter un compte gmail - Guide
- Ajouter signature word - Guide
- Ajouter un compte whatsapp - Guide
1 réponse
J'ai résolu mon problème avec un switch:
<?php
$shema = $_POST['shem'];
for ($i=1 ; $i<strlen($shema) ; $i++ )
{
$shema = $_POST['shem'];
$chiffre1 = substr($shema,$i-strlen($shema)-1,1);
$chiffre2 = substr($shema,$i-strlen($shema),1);
?>
var chiffre1 = <?php echo json_encode($chiffre1); ?>;
var chiffre2 = <?php echo json_encode($chiffre2); ?>;
switch (chiffre1)
{
case "1":
var CX1 = 250;
var CY1 = 150;
break;
case "2":
var CX1 = 250;
var CY1 = 250;
break;
case "3":
var CX1 = 250;
var CY1 = 350;
break;
case "4":
var CX1 = 150;
var CY1 = 150;
break;
case "5":
var CX1 = 150;
var CY1 = 250;
break;
case "6":
var CX1 = 150;
var CY1 = 350;
break;
case "7":
var CX1 = 50;
var CY1 = 150;
break;
case "8":
var CX1 = 50;
var CY1 = 250;
break;
case "9":
var CX1 = 50;
var CY1 = 350;
break;
default:
console.log("wrong number");
}
switch (chiffre2)
{
case "1":
var CX2 = 250;
var CY2 = 150;
break;
case "2":
var CX2 = 250;
var CY2 = 250;
break;
case "3":
var CX2 = 250;
var CY2 = 350;
break;
case "4":
var CX2 = 150;
var CY2 = 150;
break;
case "5":
var CX2 = 150;
var CY2 = 250;
break;
case "6":
var CX2 = 150;
var CY2 = 350;
break;
case "7":
var CX2 = 50;
var CY2 = 150;
break;
case "8":
var CX2 = 50;
var CY2 = 250;
break;
case "9":
var CX2 = 50;
var CY2 = 350;
break;
default:
console.log("wrong number");
}
ctx.moveTo(CY1,CX1);
ctx.lineTo(CY2,CX2);
ctx.stroke();
<?php
}
?>
<?php
$shema = $_POST['shem'];
for ($i=1 ; $i<strlen($shema) ; $i++ )
{
$shema = $_POST['shem'];
$chiffre1 = substr($shema,$i-strlen($shema)-1,1);
$chiffre2 = substr($shema,$i-strlen($shema),1);
?>
var chiffre1 = <?php echo json_encode($chiffre1); ?>;
var chiffre2 = <?php echo json_encode($chiffre2); ?>;
switch (chiffre1)
{
case "1":
var CX1 = 250;
var CY1 = 150;
break;
case "2":
var CX1 = 250;
var CY1 = 250;
break;
case "3":
var CX1 = 250;
var CY1 = 350;
break;
case "4":
var CX1 = 150;
var CY1 = 150;
break;
case "5":
var CX1 = 150;
var CY1 = 250;
break;
case "6":
var CX1 = 150;
var CY1 = 350;
break;
case "7":
var CX1 = 50;
var CY1 = 150;
break;
case "8":
var CX1 = 50;
var CY1 = 250;
break;
case "9":
var CX1 = 50;
var CY1 = 350;
break;
default:
console.log("wrong number");
}
switch (chiffre2)
{
case "1":
var CX2 = 250;
var CY2 = 150;
break;
case "2":
var CX2 = 250;
var CY2 = 250;
break;
case "3":
var CX2 = 250;
var CY2 = 350;
break;
case "4":
var CX2 = 150;
var CY2 = 150;
break;
case "5":
var CX2 = 150;
var CY2 = 250;
break;
case "6":
var CX2 = 150;
var CY2 = 350;
break;
case "7":
var CX2 = 50;
var CY2 = 150;
break;
case "8":
var CX2 = 50;
var CY2 = 250;
break;
case "9":
var CX2 = 50;
var CY2 = 350;
break;
default:
console.log("wrong number");
}
ctx.moveTo(CY1,CX1);
ctx.lineTo(CY2,CX2);
ctx.stroke();
<?php
}
?>