Types are an essential part of any languae. Types means
variable types that defines which type of data we are using. There are six PHP
types. These are:
- bolean
- string
- float
- integer
- array
- object
Now I’ll eleborate them one by one.
Boolean: This is
the very simple type. This type determine the truth values. In truth values,
there may be “false” or “true”. Note
that both are case sensitive.
String: Php doesn’t
support Unicode, it supports “256 character set”. String is a combination of
characters and words, each chracter is a byte. String can be specifies in
single quotes and double quotes.
Flaot: We also
called floating numbers as doubles, real numbers and float. The sytax of
floating numbers can be following as
<?php
$test = 3.4;
$test = 3.4e3;
$test = 7E-9;
?>
Integer: Integer
can be any number but 3.4 like numbers are not allowed. It can range from (0 to
10) and (-10 to 0).
Array: Array is
like a table. It have values and every value is associated to a unique key. For
example:
<?php
$a = array(‘a’,’b’,’c’);
Or
$a[0] = a;
$a[1] = b;
$a[2] = c;
?>
We can also use multi-dimensional arrays. For Example
<?php
$a[0][0] = 3;
?>
Object: We often
use objects in a class, these objects can also be calles as instances. For
example.
<?php
Class test
{
Function
hello()
{
echo
“This is my first class”;
}
}
$a = new test;
test->hello();
?>
Now variable $a is a object of the class test, that are
accessing the class methods.
If someone learns to program exactly, then he will certainly write very functional applications. In my opinion, more good native applications operating directly in the cloud will contribute to an even better use of these resources.
ReplyDelete