phpday 2027 - Call for Papers

Перехід від PHP 8.2.x до PHP 8.3.x

Зміст

Ця нова мінорна версія має ряд нових можливостей та деяких несумісностей, які потрібно врахувати та випробувати перед перемиканням на неї у виробничому середовищі.

Див. також керівництво з переходу на версії PHP 7.1.x, 7.2.x, 7.3.x, 7.4.x, 8.0.x, 8.1.x, 8.2.x.

+add a note

User Contributed Notes 3 notes

up
3
Anonymous
10 days ago
<script>
    const btn = document.getElementById("btn-blague");
    const question = document.getElementById("question");
    const reponse = document.getElementById("reponse");

    btn.addEventListener("click", function() {
        fetch("https://official-joke-api.appspot.com/random_joke")
            .then(res => res.json())
            .then(donnees => {
                question.textContent = donnees.setup;
                reponse.textContent = donnees.punchline;
            });
    });
</script>
up
1
Anonymous
10 days ago
<script>
    const btn = document.getElementById("btn-blague");
    const question = document.getElementById("question");
    const reponse = document.getElementById("reponse");

    btn.addEventListener("click", function() {
        fetch("https://official-joke-api.appspot.com/random_joke")
            .then(res => res.json())
            .then(donnees => {
                question.textContent = donnees.setup;
                reponse.textContent = donnees.punchline;
            });
    });
</script>
up
-2
tata at toto dot com
25 days ago
// LES CATS EN MAJUSCULES (EXERCICE 1) // 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

<?php
    /**
     * EXERCISE
     * 
     * Given an array of strings $tab, write a PHP script that displays each string in a list (<ul> tag).
     * If the string contains the word "cat", it should be displayed in uppercase.
     */
    
    $tab = ["cat", "dog", "catapult", "catfish", "dogfish", "catamaran", "This is a cat", "This is a dog"];
    echo "<ul>";
    for ($i = 0 ; $i < count($tab) ; $i++){
        if (strpos($tab[$i],"cat") === false) {
            echo "<li>" . $tab[$i] . "</li>";
        }
        else {
            echo "<li>" . strtoupper($tab[$i]) . "</li>";
        }
    }
    echo "</ul>";

?>
    
</body>
</html>

// USE URL PARAMETERS (EXERCICE 2) //
 
if (isset($_GET["animal"]) && isset($_GET["sound"])) {
    echo("<p>The ".$_GET["animal"]." says ".$_GET["sound"]."</p>");
}
elseif (isset($_GET["animal"])) {
    echo("<p>The ".$_GET["animal"]." is silent.</p>");
}
elseif (isset($_GET["sound"])) {
    echo("<p>Which animal says ".$_GET["sound"]."?</p>");
}
else {
    echo("<p>Nothing to say here...</p>");
}
To Top