Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

PHP: How to Use an If Statement | PHP If Else Statements

5.9K views on YouTube

Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap

This PHP tutorial shows how to use an if statement in PHP. PHP If else statements are conditionals that let you make decisions in your code. PHP if statements may also include if else and else conditions. We’ll start by taking a look at the PHP relational operators and logical operators used to construct the conditional if statements.

Subscribe ➜ https://bit.ly/3nGHmNn

PHP is a backend development language that runs on a server. I suggest installing the XAMPP development server. Here is my guide to getting XAMPP set up: https://youtu.be/btauAEqaifw

Install XAMPP ➜ https://www.apachefriends.org/

📺 This tutorial is part of my PHP and MySQL for Beginners Playlist: https://www.youtube.com/playlist?list=PL0Zuz27SZ-6MeRUt-z60DRxNqcrFAUYIb

(0:00) Intro
(0:26) Start Apache in the XAMPP control panel
(0:58) Adding PHP data
(2:02) Create a PHP If Statement
(2:50) Add an else clause to the If Statement
(3:51) Conditionally displaying HTML values with PHP
(5:13) Equal and Not Equal vs Strict Equal and Strict Not Equals
(7:15) More comparisons with PHP relational operators
(7:36) PHP logical operators
(9:35) PHP If / Else If / Else Statements
(12:29) Simplify long if statements with logical operators
(14:00) Nested If Statements

📺 Learn Web Dev at these sites:
https://www.freecodecamp.org
https://www.theodinproject.com

✅ Follow Me:
Twitter: https://twitter.com/yesdavidgray
LinkedIn: https://www.linkedin.com/in/davidagray/
Hashnode: https://yesdavidgray.hashnode.dev/
Reddit: https://www.reddit.com/user/DaveOnEleven

Was this tutorial about how to use an if statement in PHP helpful? If so, please share. Let me know your thoughts in the comments.

#php #if #statement