PHP 8.6.0 RC5 available for testing

Migrating from PHP 8.2.x to PHP 8.3.x

Table of Contents

This new minor version brings with it a number of new features and a few incompatibilities that should be tested for before switching PHP versions in production environments.

See also the migration guides for PHP versions 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 1 note

up
0
tata at toto dot com
17 hours 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