Lesson 15 of 3050%

(Progress persistence is disabled until Phase 9)

PHP
Beginner

Comparison Operators

Learn about Comparison Operators in PHP.

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

Real code examples

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

var_dump($x == $y);  // true (Equal value)
var_dump($x === $y); // false (Not identical type)
var_dump($x != 50);  // true (Not equal)
var_dump($x > 50);   // true (Greater than)
?>

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