From the course: PHP for Non-Programmers
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Comparing variables and values - PHP Tutorial
From the course: PHP for Non-Programmers
Comparing variables and values
- [Narrator] Determining if something is true is a powerful thing in a programming language. It's the root of all decision making. You want the computer to do something based on specific actions. For example, when you click an icon, you want an app to launch. If you turn on dark mode, you expect the color scheme of your device to change. You want to print items on the list, as long as there are more items to print. Determining if something is true or false in PHP requires several components. But first and foremost, we need a new variable type, booleans. A boolean variable can be one of two values, true or false. So you can imagine it like this: x gets true, y gets false. As a small aside, PHP can also treat any integer less than one as false and any integer one or higher as true. So with booleans, we have the ability to say something is true or false. But how do we actually determine the statements? That's where…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.