Hello, welcome to zhullyblog. If this is your first time here , please
Subscribe to Zhullyblog by Email to get latest tutorial.
PHP data types
The data type defines the values that can be stored in each variables. As we all know that values are quite different from each other. We have the floating point number which can take decimal value while integers takes only decimal numbers.
There are eight primitive data types which are :
• Integer
• Floating point number
• Boolean
• String
• Null
• Objects
This tutorial will walk you through each data type.
PHP Integer
Integers are whole numbers which can either be positive or negative e.g 1, 2, 5, -1 , -10. They are numbers without a decimal.
$x = 6;
$y =-6;
PHP floating point number
Floating point number are decimal or fractional numbers such as 1.2 , 5.367 etc.
$a = -100.7;
$b = 20.5;
PHP Boolean
Boolean generally have only two possible value which are either true or false. We can represent true as 1 and false as 0.
$x = true;
$y = false;
PHP strings
A string is a sequence of character. A string can be a letter , number , special characters, combination of both letters and numbers and are as large as 2GB.
In PHP , a string is enclosed in a single quote or double quotes.
Let’s take an example.
$str1 = "Hello";
$str2 = "What is your name?";
PHP Null
The NULL in PHP is used to represent a variable that is empty. This means that it returns no data. It is a variable without any data.
$a;
$b = 30.5;
$b = null;
PHP Objects
An object is a data type that stores the information of a data and also the data itself.
An object is stores the property of a data.
Please share
1) Introduction to PHP
2) PHP Syntax
3) PHP Comment
5) PHP Variables
6) PHP Echo and Print - How to display output
7) PHP If, if else and if elseif statement
8) PHP Lopps - While , Do while
9) PHP Strings : How to create and manipulate Strings
10) PHP Arrays
11)PHP FORMS: How to create a form, access data submitted in the form by user
Follow us on
Comments
Post a Comment