2iia - Formations
2iia Menu Avion
2iia / FORMATION EN LIGNE

Calculatrice PHP

Effectuez des calculs simples

Opérations disponibles :

Saisissez vos données :

Code à copier :

<!DOCTYPE html>
<html lang="fr">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Utilisez notre calculatrice PHP simple pour effectuer des opérations mathématiques de base.">
    <meta name="keywords" content="calculatrice, php, mathématiques, 2iia, programmation">
    <meta name="robots" content="index, follow">
    <meta name="organization" content="2iia">
    <meta name="address" content="11 rue Daguerre, Paris, 75014, Île-de-France, France">
    <meta name="region" content="Île-de-France">
    <meta name="google-site-verification" content="DV6tpAHrvGRSKhf5o3r61pYAJRxRl4hVbe9nKgSGaJE">
    <title>Calculatrice PHP | 2iia</title>
    <link rel="canonical" href="https://www.2iia.com/calculatrice.php">
    <link rel="icon" href="img/favicon.ico" type="image/ico">
    <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
    <link rel="manifest" href="/site.webmanifest">
    <meta property="og:title" content="Calculatrice PHP | 2iia">
    <meta property="og:description" content="Utilisez notre calculatrice PHP simple pour effectuer des opérations mathématiques de base.">
    <meta property="og:image" content="https://www.2iia.com/img/2iia.jpg">
    <meta property="og:url" content="https://www.2iia.com/calculatrice.php">
    <meta property="og:type" content="website">
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content="Calculatrice PHP | 2iia">
    <meta name="twitter:description" content="Effectuez des calculs simples avec notre calculatrice PHP chez 2iia.">
    <meta name="twitter:image" content="https://www.2iia.com/img/2iia.jpg">
    <script>
        (function(w, d, s, l, i) {
            w[l] = w[l] || [];
            w[l].push({
                'gtm.start': new Date().getTime(),
                event: 'gtm.js'
            });
            var f = d.getElementsByTagName(s)[0],
                j = d.createElement(s),
                dl = l != 'dataLayer' ? '&l=' + l : '';
            j.async = true;
            j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
            f.parentNode.insertBefore(j, f);
        })(window, document, 'script', 'dataLayer', 'GTM-55SP3RLD');
    </script>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/font-awesome.min.css">
    <link rel="stylesheet" href="css/icofont.css">
    <link rel="stylesheet" href="style.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.4.0/jspdf.umd.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.3.2/html2canvas.min.js"></script>
    <script src="script.js" defer></script>
    <script type="application/ld+json">
        {
            "@context": "http://schema.org",
            "@type": "Organization",
            "name": "2iia",
            "url": "https://www.2iia.com",
            "address": {
                "@type": "PostalAddress",
                "streetAddress": "11 rue Daguerre",
                "addressLocality": "Paris",
                "postalCode": "75014",
                "addressRegion": "Île-de-France",
                "addressCountry": "France"
            },
            "contactPoint": {
                "@type": "ContactPoint",
                "email": "rolanddehghank@yahoo.com",
                "telephone": "+33-7-80-89-36-89",
                "contactType": "service client"
            }
        }
    </script>
    <style>
        .vegetation-list a {
            font-family: 'Inter', sans-serif;
            font-size: 1rem;
            font-weight: 500;
            color: #00aaff;
            text-decoration: none;
            padding: 2px 4px;
            border-radius: 3px;
            transition: color 0.3s ease, background-color 0.3s ease;
        }

        .vegetation-list a:hover {
            color: #ffffff;
            background-color: #1a3c5a !important;
            text-decoration: none;
        }

        .vegetation-list .losange {
            display: inline-block;
            width: 8px;
            height: 8px;
            background-color: #213038ff !important;
            transform: rotate(45deg);
            margin-right: 10px;
        }

        input[type="number"],
        select {
            width: 100%;
            padding: 0.8rem;
            margin-bottom: 1rem;
            border: none;
            border-radius: 5px;
            background-color: #1b252dff;
            color: #ffffff;
            font-family: 'Inter', sans-serif;
            font-size: 1rem;
            transition: background-color 0.3s ease;
        }

        input[type="number"]:focus,
        select:focus {
            outline: none;
            background-color: #1b252cff;
            box-shadow: 0 0 0 2px #00aaff;
        }

        label {
            font-family: 'Inter', sans-serif;
            font-size: 1rem;
            font-weight: 500;
            color: #ffffff;
            margin-bottom: 0.5rem;
            display: block;
        }

        pre {
            background-color: #1c262fff;
            padding: 1rem;
            border-radius: 5px;
            border: 1px solid #2d5a7a;
            text-align: left;
            max-height: 260px;
            overflow-y: auto;
            margin: 1rem 0;
            scrollbar-color: #00aaff #1a3c5a;
        }

        code {
            font-family: 'Courier New', monospace;
            font-size: 0.9rem;
            color: #e0e0e0 !important;
        }
    </style>
</head>

<body class="dark-theme">
    <noscript>
        <iframe src="https://www.googletagmanager.com/ns.html?id=GTM-55SP3RLD" height="0" width="0" style="display:none;visibility:hidden"></iframe>
    </noscript>
    <?php include 'templates/header.php'; ?>
    <div class="vegetation-container">
        <div class="vegetation-content">
            <h1 class="vegetation-subtitle">Calculatrice PHP</h1>
            <h2 class="vegetation-subtitle">Effectuez des calculs simples</h2>
            <h2 class="vegetation-subtitle">Opérations disponibles :</h2>
            <ul class="vegetation-list">
                <li><span class="losange"></span> Addition (+)</li>
                <li><span class="losange"></span> Soustraction (-)</li>
                <li><span class="losange"></span> Multiplication (×)</li>
                <li><span class="losange"></span> Division (÷)</li>
            </ul>
            <h2 class="vegetation-subtitle">Saisissez vos données :</h2>
            <form method="POST" action="">
                <label>Premier nombre :</label>
                <input type="number" name="num1" step="any" required>
                <label>Deuxième nombre :</label>
                <input type="number" name="num2" step="any" required>
                <label>Opération :</label>
                <select name="operation" required>
                    <option value="+">+</option>
                    <option value="-">-</option>
                    <option value="*">×</option>
                    <option value="/">÷</option>
                </select>
                <button type="submit" class="elegant-button">Calculer</button>
            </form>
            <?php
            if ($_SERVER["REQUEST_METHOD"] == "POST") {
                $num1 = floatval($_POST["num1"]);
                $num2 = floatval($_POST["num2"]);
                $operation = $_POST["operation"];
                $resultat = "";
                switch ($operation) {
                    case '+':
                        $resultat = $num1 + $num2;
                        break;
                    case '-':
                        $resultat = $num1 - $num2;
                        break;
                    case '*':
                        $resultat = $num1 * $num2;
                        break;
                    case '/':
                        if ($num2 == 0) {
                            $resultat = "Erreur : Division par zéro !";
                        } else {
                            $resultat = $num1 / $num2;
                        }
                        break;
                    default:
                        $resultat = "Opération non valide";
                }
                echo "<h2 class='vegetation-subtitle'>Résultat :</h2>";
                echo "<p>$num1 $operation $num2 = $resultat</p>";
            }
            ?>
            <h2 class="vegetation-subtitle">Code à copier :</h2>
            <pre><code id="code-to-copy"><?php echo htmlspecialchars(file_get_contents(__FILE__)); ?></code></pre>
            <button onclick="copyCode()" class="elegant-button">Copier le code</button>
            <button onclick="window.location.href='https://2iia.com/contactez-nous.php'" class="elegant-button" aria-label="Nous contacter">Nous contacter</button>
        </div>
        <div class="cta-container">
            <div class="cta-block"></div>
        </div>
    </div>
    <div class="spacer-flash"></div>
    <?php include 'templates/footer.php'; ?>
    <script>
        function copyCode() {
            var code = document.getElementById("code-to-copy").innerText;
            navigator.clipboard.writeText(code);
            alert("Code copié !");
        }
    </script>
</body>

</html>
Footer