PHP Program To Demonstrate Various Datatype

PHP Program To Demonstrate Various Datatype

Write PHP Program to Demonstrate Various Datatypes

<!--Write PHP Program to Demonstrate Various Datatypes-->
<html>
    <body>
            <?php   
                //integer 
                $i1 = 34;  
                $i2 = 0243;  
                $i3 = 0x45;  
                echo "Decimal number: " .$i1;  
                echo "<br>Octal number: " .$i2;  
                echo "<br>HexaDecimal number: " .$i3; 
                
                //float 
                $n1 = 19.34; 
                echo "<br>Floating number : " .$n1;
                
                //String
                $string = "World";  
                //both single and double quote statements are allowed 
                echo "<br>String with Double Quotes : ";
                echo "Hello $string"; //here it will concate $string's value    
                echo "<br>String with Single Quotes : ";
                echo 'Hello $string';  //here it will print all the words enclosed with ' ' 
                
                //Boolean
                if (TRUE)  
                    echo "<br>This condition is TRUE.";  
                if (FALSE)  
                    echo "<br>This condition is FALSE.";  
 
            ?>
    </body>
</html>

Output:

Decimal number: 34
Octal number: 163
HexaDecimal number: 69
Floating number : 19.34
String with Double Quotes : Hello World
String with Single Quotes : Hello $string
This condition is TRUE.