PHP 8 Beginner Basics · 1 min read

PHP logical operators

Start the PHP 8 learning path »

❮ PHP 8 Home All Tutorials ❯

How do I combine conditions?

&& || !.

Example

PHP 8 Example
<?php
$loggedIn = true;
$isAdmin = false;
if ($loggedIn && ! $isAdmin) {
  echo 'Member area';
}

Line-by-Line Walkthrough

Use parentheses when mixing && and ||.

Need more coins?

You do not have enough coins for this action.

Your balance: 0 coins

Share

Reactions

Loading reactions…