PHP, Introduction and Datatype
PHP, Introduction and Datatype
SCIENCE
PRESENTATION
TOPIC-PHP, INTRODUCTION AND
DATATYPE
Variables can store data of different types, and different data types can
different things.
PHP supports the following data types:
1. String
2. Integer
3. Float
4. Boolean
5. Array
6. Object
7. NULL
8. Resource
PHP String
• A string is a sequence of characters, like “Hello world!”.
• A string can be any text inside quotes. You can use single or double
quotes.
Example
<?php
$x = “Hello world!”;
$y = ‘Hello world!’;
echo $x;
echo “<br>”;
echo $y;
?>
PHP integer
NULL is a special data type which can have only one value: NULL.
A variable of data type NULL is a variable that has no value assigned
to it.
Tip: If a variable is created without a value, it is automatically
assigned a value of NULL.
Variables can also be emptied by setting the value to NULL:
Example
<?php
$x = “Hello world”;
$x = null;
var_dump($x);
?>
PHP Resource