PHP allows to work with following data types :
1. String
2. Integer
3. Float (floating point numbers - also called double)
4. Boolean
5 .Array
6. Object
7 .NULL
8. Resource
<?php
$txt = "Hi Hello world!";
$x = 5;
$y = 10.5;
?>
Difference Between ‘ ’ and “ ”
<?php
$variable = "name";
$novariable = 'My $variable will not print!';print($novariable);
print "<br>";
$novariable = "My $variable will print!";
print($novariable);
?>
Scope of Variable - Global - Without keyword
<?php
$a = 5;
function myFunction() {
echo "<p>Variable a inside function is: $a</p>";
}myFunction();
echo "<p>Variable a outside function is: $a</p>";
?>
Scope of Variable - Global - With keyword
<?php
$x = 5;
$y = 10;function myFunction() {
global $x, $y;
$y = $x + $y;
}myFunction();
echo $y;
?>
Using Global keyword with Array
<?php
$x = 5;
$y = 10;function myFunction() {
$GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];
}myFunction();
echo $y;
?>