[Gukulkan]

Learn, develop, play.

Variables in JavaScript (js)

For declare variable in javascript we use var tag.

Example:

var x;

Numeric:

var x = 5;

Arithmetic:

var x = 4+1;

Fractional:

var x = 4.1;

String:

var x = "string";

Logical:

var x = false;

Arrays:

var x = new Array(1, "string", 5.3, false);

Work with variables PHP

Work with variables in PHP is easy.

If you need a sum of numbers – use “+”
If we concatenate two lines – use “+”

$x = 3;
$y = 4;
$z = $x + $y;

$i = "Hello";
$y = "World";
$k = $i + $k;

Variable in PHP

Variables in PHP are defined very simply. It is not necessary to define the types of variables.

all that you need write next



Here we define a variable like 4



Now like string.

To show this variable you can write this lines