<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">

<!--
    Our first PHP-enabled HTML document...?

    by: Sharon Tuttle
    last modified: 2024-03-19

    you can run this using the URL:
    https://nrs-projects.humboldt.edu/~st10/s24cs328/328lect09-1/328lect09-1-play1.php

    made the XHTML version for strict-validation using:
    php 328lect09-1-play1.php > 328lect09-1-play1.xhtml
-->

<head>
    <title> 328lect09-1-play1 </title>
    <meta charset="utf-8" />

    <?php
        /*===
            function: square: float -> float
            purpose: expects a number, returns the square of
                that number
            examples:
                square(2.5) == 6.25
                square(4)   == 16
        ===*/

       function square($num)
       {
           return $num * $num;
       }
    ?>

    <link href="https://nrs-projects.humboldt.edu/~st10/styles/normalize.css"
          type="text/css" rel="stylesheet" />
</head>

<body>

    <h1> Our First PHP-enabled document! </h1>

    <?php
        // Note the PHP expression tags below 
        //     calling the PHP function square.
    ?>
    
    <p> Please show me the square of 2.5: <?= square(2.5) ?> </p>

    <p> Please show me the square of 4: <?= square(4) ?> </p>

    <footer>
    <hr />
    <p>
        Validate by pasting .xhtml copy's URL into<br />
        <a href="https://validator.w3.org/nu">
            https://validator.w3.org/nu
        </a>
        or  
        <a href="https://html5.validator.nu/">
            https://html5.validator.nu/
        </a>
    </p>
    </footer>
</body>
</html>