note 125272 added to language.types.boolean

From: Date: Sat, 15 Aug 2020 07:40:13 +0000
Subject: note 125272 added to language.types.boolean
Groups: php.notes 
Request: Send a blank email to php-notes+get-214970@lists.php.net to get a copy of this message
let's make fun of boolean true and false.. <?php $a = TRUE; // this will print integer 1. $b = "5something22" + true; // from the string it will take 5 then +1 = 6 echo $a + $b; // prints 1 + 6 = 7 $c = 9.6 + true * 9; // true will be 1 echo $c; // prints 9.6 + 1*9 = 18.6. the number will be floating type. //let's do more maths with boolean echo (true/false); // prints: INF 1 for true,0 for false.so 1/0 = infinity echo (true/true); // prints: 1 / 1 = 1 echo (false/true); // prints: 0 / 1 = 0 echo (false/true); // prints: 0 / 0 = NAN echo (sqrt(-true)); // prints sqrt(-1) = NAN echo (log(true)); // prints: log(1) = 0 echo (log(false)); // prints: log(0) = -INF it is minus infinity. //let's do some trigonometry with boolean echo (acos(true)); // prints: arc cos(1) = 0 echo (acos(-true)); // prints: arc cos(-1) = PI = 3.1415926535898 echo (acos(false)); //prints: arc cos(0) = PI/2 = 1.5707963267949 echo (acos(true+TRUE)); // prints: arc cos(1+1) = NAN Awesome this is!! Isn't it?? (1 or 0) ---- Server IP: 45.112.84.4 Probable Submitter: 103.51.166.36 (proxied: 37.111.193.164) ---- Manual Page -- http://php.net/manual/en/language.types.boolean.php Edit -- https://master.php.net/note/edit/125272 Del: integrated -- https://master.php.net/note/delete/125272/integrated Del: useless -- https://master.php.net/note/delete/125272/useless Del: bad code -- https://master.php.net/note/delete/125272/bad+code Del: spam -- https://master.php.net/note/delete/125272/spam Del: non-english -- https://master.php.net/note/delete/125272/non-english Del: in docs -- https://master.php.net/note/delete/125272/in+docs Del: other reasons-- https://master.php.net/note/delete/125272 Reject -- https://master.php.net/note/reject/125272 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#214970) next »