Search This Blog

  • ()
  • ()
Show more
PHP Tutorial - PHP Boolean
HomeTutorialsPROGRAMMIM

PHP Tutorial - PHP Boolean

Booleans hold either true or false. Behind the scenes, booleans are integers. false value In addition, PHP considers the following values to...

Booleans hold either true or false. Behind the scenes, booleans are integers.

false value


In addition, PHP considers the following values to be false :

  • The literal value false

  • The integer zero (0)

  • The float zero ( 0.0 )

  • An empty string ( " " )

  • The string zero ( "0" )

  • An array with zero elements

  • The special type null (including any unset variables)

  • A SimpleXML object that is created from an empty XML tag


All other values are considered true in a Boolean context.

We can assign true or false value to a boolean type variable.


<?PHP/* w w w . j av a2 s . c o m*/
$bool = true;
print "Bool is set to $booln";
$bool = false;
print "Bool is set to $booln";
?>


The code above generates the following result.


Example 2


In the second if statement we compare the integer value to a boolean value.


<?PHP/* w w w .j a va 2 s . c o m*/
$a=100;
if($a==100) {
echo "the variable equals 1!n";
}

if($a==true) {
echo "the variable is true!";
}
?>


The code above generates the following result.
Name

apple,2,Article,14,At home,13,Author,14,Beauty,1,Biography,2,blackberry,1,Business,6,Cars,5,Celebrity,13,conspiraci,15,Fashion,5,galaxy,1,Gallery,1,Games,11,google,1,Hair,1,Health amp; Fitness,2,Histori,11,Home,169,HOSTING,27,HTML,7,imac,1,Image,1,iphone,1,Itcyber,7,Kuran,31,Lajme,34,Life amp; Love,1,Makeup amp; Skincare,1,mobile,5,monitor,1,Movies,2,News,5,No category,5,Photography,6,PHP,30,Poezi,24,POEZI amp; TEKSTE,2,Post,14,PROGRAMMIM,46,Relationships,1,review,6,samsung,1,Seo,7,Softvare,4,Sport,5,Sports,7,Stars,5,Tag,7,Tags,7,Tech,30,Teknologji,37,THEMES,3,Tutorials,191,Video,47,Videos,4,Vip News,2,Webhosting,67,WordPress,7,World,13,
ltr
item
Cr337: PHP Tutorial - PHP Boolean
PHP Tutorial - PHP Boolean
http://www.java2s.com/Tutorials/PHPImage/myResult/F/FALSE_VALUE__57DB79E9CC2F5B2753D5.PNG
Cr337
https://cr337.blogspot.com/2016/03/php-tutorial-php-boolean.html
https://cr337.blogspot.com/
http://cr337.blogspot.com/
http://cr337.blogspot.com/2016/03/php-tutorial-php-boolean.html
true
5516280490839897951
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy