PHP Primitive Datatypes

 

PHP Primitive Datatypes

When we deal with different types of values e.g. Rollno, Name, Address then we need datatypes which is used to identify a specific type of data and allow operations on the datatype.

In PHP there are different type of primitive datatypes
  • Integer Datatype- Integers are whole numbers without a decimal point. e.g. 2, 2797, 989 etc.
  • Double Datatype- Double values are decimal or fractional numbers e.g. 17.01, -23.5, +2890.08 etc.
  • String Datatype- Stings are sequence of characters. We can write strings using single quotes and double quotes 
       'Hi there' and "Hi there"
        
Single and double quotes valid in PHP but there is difference in single quoted and double quoted strings.
Single quoted list all the character without any change, but double quote produce different sting output
        
E.g.
        <?PHP
        Echo 'This is \"a\" quoted character';
        Echo "<br/>";
        Echo "This is \"a\" quoted character";
        ?>
        Output:
        This is \"a\" quoted character
        This is "a" quoted character
  • Boolean Datatype- This datatype has only two possible values True and False.            

UNIT-304
Elementary Server Side Scripting through PHP
  1. PHP Introduction
  2. How to save PHP page
  3. PHP variables and their naming conventions
  4. PHP program to find maximum of 5 numbers
  5. PHP program to find minimum of 5 numbers
  6. PHP program to find sum of 2 numbers
  7. PHP program to find subtraction of 2 numbers