Lesson 16 of 3053%

(Progress persistence is disabled until Phase 9)

PHP
Beginner

Logical Operators

Learn about Logical Operators in PHP.

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

Real code examples

<?php
$x = 100;
$y = 50;

if ($x == 100 and $y == 50) {
    echo "Both are true\n";
}

if ($x == 100 || $y == 80) {
    echo "At least one is true\n";
}
?>

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

Practice This TopicTake QuizBuild a PHP Project

Ready to practise?

Apply what you learned with a hands-on challenge.

Practise This Topic