To have a boolean type in Postgres for PHP

I can't believe the next statement is still true

So, I switched to integers and 0 or 1 works fine, but it is stupid, that the database system has boolean variables of a smaller size, but I should use integers for boolean values! 

How do you use a boolean data type using Postgres / PHP?

In other words,

The only way to use 1 for true and 0 for false in getting a boolean data type?

+6
php postgresql boolean
source share
1 answer

Using 1 and 0 is a very smart and portable way to represent boolean values. Any size difference between and int and the native boolean type will really have little effect on the performance of your application or the size of your database.

0
source share

All Articles