Posted by: Sourav | February 11, 2011

Booleans in PHP


<html>
<head>
<title>
Booleans
</title>
</head>
<body>
<?php
$sourav1=true;
$sourav2=false;
?>
$bool1: <?php echo $sourav1;?><br />
$bool2: <?php echo $sourav2; ?><br />
<?php
$sou1=6;
$sou2=”sourav5098″;
$sou4=0;
$sou5=”0″;
$sou6=null;
?>
$sou1 is set: <?php echo isset($sou1);?><br />
$sou2 is set: <?php echo isset($sou2);?><br />
$sou3 is set: <?php echo isset($sou3);?><br />

<?php unset($sou1);?>

$sou1 is set: <?php echo isset($sou1);?><br />
$sou2 is set: <?php echo isset($sou2);?><br />
$sou3 is set: <?php echo isset($sou3);?><br />
empty: <?php echo empty($sou1); ?><br />
empty: <?php echo empty($sou4); ?><br />
empty: <?php echo empty($sou5); ?><br />
empty: <?php echo empty($sou6); ?><br />

</body>
</html>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: