Skip to content
Advertisement

Test if string could be boolean PHP

I’m getting a string from a $_GET and I want to test if it could be a boolean, before I use it for a part of a mysql query. Is there a better way of doing it than:

JavaScript

Advertisement

Answer

There’s, by the way, a cleaner way of writing it:

JavaScript

But yes. The one you wrote down is the only way.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement