What do you want to save?
Add Code snippet
New code examples
-
PHP 2022-03-20 07:30:27
php boolean
/** * Strings always evaluate to boolean true unless they have a * value that's considered "empty" by PHP (taken from the * documentation for empty): * "" (an empty string) evaluates as false. * "0" (0 as a string) evaul... Add solution -
PHP 2021-11-18 23:38:19
php boolean to string
/** filter_var - Filters a variable with a specific filter **/ $boolvar = filter_var('true', FILTER_VALIDATE_BOOLEAN); /** boolval - Get the boolean value of a variable PHP 5 >= */ $boolvar = boolval ('true'); // And literally with a ternary operator b... Add solution -
Javascript 2021-11-15 16:13:12
javascript compare strings
let string = "1"; let number = 1; if (parseInt(string) === number){ // STRING AND NUMBER MATCHES } if (string == number){ // STRING AND NUMBER MATCHES ALSO BECAUSE == instead of ===, means it won't compare datasets, only the content } Add solution