How to Define a Variable in PHP

Over the last few years, PHP has become the de facto choice for the development of data-driven Web applications, notably on account of its scalability, ease of use, and widespread support for different databases and data formats.
This first chapter will gently introduce you to the world of PHP, by taking you on a whirlwind tour of PHP’s history and features, and then guiding you through writing and executing your first PHP program So flip the page, and let’s get Started.The fresher students can learn coding and designing by Php Development company 

What is Variable?

Variable is nothing it's simply name of the memory location.
A Variable is just a instrumentality i.e wont to store each numeric and non-numeric info.

Rules For Variable Declaration

  • Variables in PHP starts with a dollar($) sign, followed by the name of the variable.
  • The variable name should begin with a letter or the underscore character.
  • A variable name will solely contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
  • A variable name shouldn't contain house
  • Assigning Values To Variables
  • Assigning a worth to a variable in PHP is kind of east: use the equality(=) image, that additionally to the PHP’s assignment operators.
  • This assign price on the correct facet of the equation to the variable on the left.
  • A variable is made the instant you assign a worth to it:

$Car ="Ford";
echo $Car

PHP Concatenation

$car="Ford Car";
echo $car."is riding";
Sum of two numbers

echo "sum=".$c;

Destroying PHP Variables

To destroy a variable, pass the variable to PHP’s unset( ) function.
as in the following example:
echo $name;
//unset( ) function destroy the variable reference.

Variable Names In PHP Are Case-Sensitive

echo $name."<br/>";
echo $NAME;

Difference Between $Var And $$Var In PHP

PHP $$var uses the value of the variable whose name is the value of $var.

It means $$var is known as reference variable where as $var is normal variable.
It allows you to have a “variable’s variable” – the program can create the variable name the same way it can create any other string.

echo $name."<br/>";
echo $$name."<br/>";
echo $Rajeev;

$$name is reference variable . $$name uses the value of the variable whose name is the value of $name.

echo $name print the value: Rajeev

echo $$name print the value:Sanjeev \ value of this($name) variable is act as reference of second variable($$name).

echo $rajeev print the value :Sanjeev \ Here $Rajeev is also act as reference variable.

We have mention below some special article for PHP Developer or Software Developer

Function Use in PHP

How to Define Array in PHP

Applied AI in Software Development

Software Improvement by Data Improvement

How Digital Marketing Works

Faridabad Ford | Best Ford Showroom and Dealership in Faridabad

Welcome to Faridabad Ford, the largest & best ford showroom and dealership in Faridabad, your Biggest Ford Dealer for New and Used Car Sales, Servicing, Parts and Accessories.

Ghaziabad Ford | Best Ford Showroom and Dealership in Ghaziabad

Welcome to Ghaziabad Ford, the largest & best ford showroom and dealership in Ghaziabad, your Biggest Ford Dealer for New and Used Car Sales, Servicing, Parts and Accessories. We can help make your process of Buying, Servicing or Selling your car a lot easier.

List of Backlinks

List Backlinks


  1. Best Grade Health Care Products Available Online. Genuine and 100% Guarantee on all orders you place.
    We Have the Best you
    will come across On line. We As well Provide Tracking , on Packages as they are being sent and
    also Tracking on recent
    orders .
    We have variety of Pain killers for sale at affordable prices.

    We are the best
    suppliers of pain medications and research chemicals .our prices are affordable .

    For more details contact our website through any of the details provided below

    Medication Kings

    Website ...

    Emails ....

    +1 (503) 985-6723


Post a Comment

Popular posts from this blog

How Outsourced Healthcare Services Leads to Improved Patient Experience?

BS6 compliant Ford EcoSport launched in India, price starts at Rs 8.04 lakhs

Benefit of using profile creation for your business