Safcode Institute by Sir Safder





  • Data Types & Variable

    In PHP there are many Primitive Data types such as Integer,
    Float, String, Boolean, Array and Object. Data Types defines
    the operations can be performed to create variable of any type.
    
    Variable is used to store data and it can store different 
    types of data with different datatypes. 
    
    They are listed below:
    
    1) Int (integer)
    2) String 
    3) Float
    4) Boolean
    5) Array
    6) Object
    
    INT (integer)
    Integer datatype accepts only numeric values without Inverted Commas. 
    Its size is 4 bytes and its range is -2,147,483,647 to 2,147,483,647.
    
    String
    String datatype accepts alphanumeric values with double Inverted Commas.
    Its size is 8 bytes and its range is billion (65,400 for Win 3.1)
    
    Float
    Float datatype accepts numeric and decimal point values 
    without inverted commas. Its size is 4bytes.
    
    Boolean
    Boolean datatype is use when we check condition and its 
    returns only true or false. Its size is 1 byte.
    
    Array
    Array datatypes represent the collection of elements like:  
    values and variables. Its hold large element collections. 
    Its range is difference between the maximum value and the 
    minimum value in the distribution. 
    
    Object
    Object datatypes allows you to java object.
    
    Variables
    Variables are used to store information. They also provide 
    a way of labeling data with a descriptive name. 
    In PHP, Variable begins with the $ sign, taken after by the
     tittle of the variable.
    
    Example:  
    <?php
    $text= "hello world";
    $abc= 2021;
    $xyz = 10.5;
    
    echo $text;
    echo $abc;
    echo $abc;
    echo $xyz;
    
    ?>



  • You Can Also Watch Our Tutorial