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

<!--
    Examples from CS 328 - Week 10 Lecture 2 - 2025-04-02

    by: Sharon Tuttle
    last modified: 2025-04-05

    you can run this using the URL:

    https://nrs-projects.humboldt.edu/~st10/s25cs328/328lect10-2/328lect10-2.php
-->

<head>
    <title> 328lect10-2 </title>
    <meta charset="utf-8" />

    <?php
      	ini_set('display_errors', 1);
        error_reporting(E_ALL);

        // class style: use require_once in the head element to include 
        //    PHP functions from another file that you wish to use in
        //    this document

        require_once("square.php");
    ?>
    
    <link href="https://nrs-projects.humboldt.edu/~st10/styles/normalize.css"
          type="text/css" rel="stylesheet" />
</head>

<body>
    <h1> Demos from CS 328 - Week 10 lecture 2 </h1>

    <?php
    /*=== demo: PHP has a concatenation operator of . (from Perl) ===*/
    ?>
    
    <p> <?= "a" . "b" . "c" ?></p>

    <?php
    /*===
        demo of variable interpolation: variables in a double-quoted
            string will be replaced with their value
        (and note that variable interpolation does not take place in 
            a single-quoted string - the variable name will remain)
    ===*/
    ?>
    
    <?php
        $looky = 13;
    ?>

    <p> <?= "what is this: $looky" ?> </p>

    <p> <?= 'what is this: $looky' ?> </p>

    <?php
    /*===
        when you want non-blank characters before or after an
            interpolated variable's value,         
        you can use { directly before, and } after, a variable named
            in a double-quoted string to ensure that the PHP engine
            can tell what the variable's name is
    ===*/
    ?>
    
    <p>	<?= "0{$looky}0" ?> </p>

    <?php
    /*=== examples calling a PHP function ===*/
    ?>
    
    <p> The square of 9 is <?= square(9) ?> <br />
        and the square of 27 is <?= square(27) ?> </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>