True and False

As you remember from Chapter 2, PHP has the concepts of true and false. Zero and an empty string are considered to be false. Any other numerical value or string is true. These concepts were discussed in regard to relational operators, but they are also used in control statements. Control statements like if expect a boolean value, so any value they are given will be converted to a boolean.

Get Core PHP Programming: Using PHP to Build Dynamic Web Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.