So we are going to learn of what kind of data types in PHP.

Let's get started with variables, start with $, followed by letter or underscore, with no spaces.


Code:
<html>
<head>
<title>variables</title>
</head>
<body>
<?php
$var1 = 10;
echo $var1;
echo </ br>
$var2 = "hello world";
echo $var2;
?>
</body>
</html>
Variables determine a vary, we use echo to see our variables value. Variables can be a number or words, if you're using words, put " and " then strings.

Code:
<html>
<head>
<title>strings</title>
</head>
<body>
<?php
echo "hello world";
?>
</body>
</html>
fyi, hello world is a string
now for numbers we can do simple math

Code:
<html>
<head>
<title>numbers</title>
</head>
<body>
<?php
$var1 = 10;
echo ($var1 + 1);
?>
</body>
</html>
if we use a variable set to 10+!, in our browser we get 11

arrays

Code:
<html>
<head>
<title>arrays</title>
</head>
<?php
$array1 = array (3,8,15,16,23,42);
echo $array[1];
?>
arrays are basicly more than one variable in the same array
and as you can see i echoed array 1, wich will give us number 8, because arrays start from 0

booleans and NULL ( true or false )

Code:
<html>
<head>
<title>booleans and NULL</title>
</head>
<body>
<?php
$bool1 = true;
$bool2 = false;
$var1 = 3;
$var2 = "cat";
echo isset($var1);
echo isset($var2);
echo isset($var3);
?>
</body>
</html>
If I writen 2 variables and asked if var1, var2, and var3 are true or false
in our browser you can see that you will get number 1 ( true ) for var1 and var2, but nothing for var3 because it is false

constants

Code:
<html>
<head>
<title>constants</title>
</head>
<body>
<?php
$max_width = 980;
define("MAX_WIDTH", 980);
echo MAX_WIDTH;
>?
</body>
</html>
they are very similar to variables except they dont vary and it doesn't have $ before, because its a constant