FILTER_VALIDATE_BOOLEAN

Return TRUE for “true”, “1”, “on” and “yes”, FALSE for “0”,”false”, “off”, “no”, and “”, NULL otherwise

Example
======

<?php
echo filter_var(“Yes”, FILTER_VALIDATE_BOOLEAN);
?>

Output
=====

1

Leave a Reply

Your email address will not be published. Required fields are marked *