Docsity

PHP Data type program, Exercises of Computer Science

Toggle sidebar
bg1
<?php
$intvar=4.5;
$floatvar=7.5;
$strvar="Hello";
$boolvar="Ranjan";
$nullval='null';
if(is_int($intvar))
{
echo "$intvar is integer";
}
else
{
echo "$intvar is not integer";
}
if(is_float($floatvar))
{
echo "$intvar is float";
}
else
{
echo "$intvar is not float";
}
if(is_string($strvar))
{
echo "$strvar is string";
}
else
{
echo "$strvar is not string";
}
if(is_bool((bool)$boolvar))
{
echo "$boolvar is boolean ";
}
else
{
echo "$boolvar is not boolean and value is false";
}
if(is_bool((bool)$nullval))
{
echo "$nullval is boolean and value is true";
}
else
{
echo "$nullval is not boolean and value is false";
}

Partial preview of the text

Download PHP Data type program and more Exercises Computer Science in PDF only on Docsity!