note 75956 deleted from function.intval by cmb
| From: | cmb@php.net | Date: | Sun, 16 Feb 2020 13:49:01 +0000 |
| Subject: | note 75956 deleted from function.intval by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-214142@lists.php.net to get a copy of this message | ||
Note Submitter: vizigr0u at gmail dot com
----
intval used on bools returns either 1 or 0
I usually use this to properly set bools in my tables
(assuming you use some kind of int like tinyints as booleans) :
<?php
$myvar = 'right value';
mysql_query('INSERT INTO mytable (activated)
VALUES(' . intval($myvar === 'right value') . ')');
?>