Lesson 3 PHP (Conditional)

Pada simulasi ini saya akan memberikan contoh conditional pada PHP. Adapun conditional dalam penjelasan mudahnya adalah penggunaan IF-ELSE.

Berikut script nya :

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Lesson 3</title>
    </head>
    <body>
 
        <?php
        $sampleVar = "hello world";
        if ($sampleVar == "hello world") {
            // jika variabel $sampleVar berisi hello world
            echo $sampleVar;
        } else {
            // jika variabel $sampleVar tidak berisi hello world
            echo "bukan hello world";
        }
        ?>
    </body>
</html>

Atau bisa dilihat simulasinya disini.

– marifnst –

Leave a Reply

Your email address will not be published. Required fields are marked *

Afiseaza emoticoanele Locco.Ro