[Gukulkan]

Learn, develop, play.

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



Hello world in PHP

So it’s time to start writing about PHP

Now we’ll write the first line of code in PHP.

[cc lang=”php”]

[/cc]

And now look at the code

< ? php – this is a sign for the server: the PHP code starts

echo “Hello world! This my first program!”; – echo command says display string.

? > – this is a sign for the server: the PHP code ends