How to use variable and Expression in PHP

What are Variables?

Variable is used to store data that keeps on changing during the execution of a program. There are different types of data can be store in a program by web developer.

What are Expressions?

Expression is a combination of variables, constant, functions and operators.

Variables and its data types…

A variable is an identifier who changes the value throughout the execution of a program. The name refers to the variable and the data type refers to the type of data that a variable can store. PHP supports eight primitive data types.

 

Here you can see how to store data in variable and execute output.

 

<?php

 

$a= “ Hello \n ” ; // attempting multi-line output

$b= “ World \n ” ; // attempting multi-line output

Echo $a;

Echo “<br>”; // to break a line

Echo $b;

?>

 

Output:

Hello

World