Lesson 10 of 3033%

(Progress persistence is disabled until Phase 9)

PHP
Beginner

Booleans

Learn about Booleans in PHP.

PHP is a powerful server-side language. In this lesson, we will cover Booleans.

Real code examples

<?php
$isLoggedIn = true;
$hasAdminRights = false;

if ($isLoggedIn) {
    echo "Welcome back!";
}

// Falsey values include: false, 0, 0.0, "", "0", array(), null
?>

Common mistakes

Make sure you include the <?php tag when writing PHP!

Try It Yourself

You can experiment with this in the Playground.

Lesson Progress

Take QuizBuild a PHP Project