PHP or Hypertext preprocessor is a scripting language that is used widely worldwide. It is especially used in the web development with great ease. It can be embedded into HTML with great ease. It will help to create dynamic and interactive web pages. It is a very efficiently used scripting language. It is a very simple language that can be used by the beginners without any difficulty. It will also provide many advanced features. PHP development is focused on the server side scripting language. This is a language that is used to create content that is used to interact with the databases. Variable are the key factors in the PHP language. It is used to store any information with great ease. In PHP, the variable name starts with the $ sign. The variable must start with the letter or underscore character. Then it will be followed with the name of the variable. The text that is stored in the variable must be quoted with double quotes. In PHP there is no way for declaring the variable. The declaration of the variable will be done at the time the value is assigned to the variable. Variable names are case sensitive in PHP. This application will help in understanding the concept of variables in PHP.

In this tutorial I will explain how to create php variables. Before creating example program I will give you brief explanation of variables.

Variables in PHP

Variables which stores values, numbers, etc.

In PHP, a variable starts with the $ sign.

Like c program or c++ programmin no need to define variable data types in php.

Now I will create one string variable.
$txt = “Hello world!”;
When you quote double quotes to the text value that becomes string variable.

Now I will create one integer variable.
$number1 = 5;

Now I will create floating point variable.
$number2 = 10.5;

Video demonstration:

 

Anu

Do you have anything to Ask?

This site uses Akismet to reduce spam. Learn how your comment data is processed.