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:

Example
<?php
$Car ="Ford";
echo $Car
?>

PHP Concatenation


Example
<?php
$car="Ford Car";
echo $car."is riding";
?>
Sum of two numbers

<?php
$a=100;
$b=200
$c=$a+$b;
echo "sum=".$c;
?>

Destroying PHP Variables


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

Variable Names In PHP Are Case-Sensitive

<?php
$name="rexx";
$NAME="rahul";
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.
Example

<?php
$name="Rajeev";
$$name="Sanjeev";
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
http://www.faridabadford.com/
http://www.ghaziabadford.com/

List Backlinks

http://p.booklog.jp/users/ramahyundao/profile

https://angel.co/company/hyundai-service-centre-in-delhi

https://buzzon.khaleejtimes.com/author/hyundai/

https://comicvine.gamespot.com/profile/ramahyundai/about-me/

http://newsservice.gordon.edu/2013/04/local-hazardous-waste-cleanup-gains.html?showComment=1563518429600#c2415004515656815528

http://ghmahendra.staf.upi.edu/2017/10/hello-dunyo/#comment-225847

http://strategicplanning.dartmouth.edu/working-groups/alumni/alumni-question-4

https://www.wou.edu/wp/tims/2014/02/14/creating-an-online-promotion-portfolio/#comment-125312

http://channywijaya.staff.ipb.ac.id/karya-ilmiah-populer/comment-page-399/#comment-210100

https://blog.zhdk.ch/ckennel/2013/02/13/salome-rohfassung/#comment-54855

https://lke.cs.buap.mx/2016/index.php/2015/08/06/hello-world/#comment-25121

http://beasiswa.mercubuana.ac.id/2008/11/daftar-universitas-sekolah-tinggi.html?showComment=1563523399359#c2354194967135441509

http://blogs.stlawu.edu/jbpcultureandmedia/2013/10/27/blog-entry-7-how-do-we-secure-personal-data/comment-page-2808/#comment-215512

https://homepages.fhv.at/dma/norwegen/guestbox/guestbox.php?0&480&830&150&140&520&270&Anfangsposition=670

http://eventsblog.boa.ac.uk/2011/06/kirschner-k-wire-fixation-of-upper-limb.html?showComment=1563523891188#c4915551378868448288

http://brown.faculty.concordia.edu/p/blog-page.html?showComment=1563523960453

https://www.blogger.com/comment.g?blogID=3854472437184520211&postID=233496559628672584&page=3&token=1563524095181

http://blog.binadarma.ac.id/ariezaki/?p=964#comment-1541626

https://moodle.forthvalley.ac.uk/mahara/view/view.php?id=56798

http://cavile2.h.media.illinois.edu/jour425/?p=246#comment-112624

http://imec.edu.co/inicio/about/#comment-19474

http://muzickasa.edu.ba/festival-of-flutes/#comment-101996

http://natsihec.edu.au/rock-bgd/#comment-4513

http://kpcole2.h.media.illinois.edu/planet/?p=457#comment-175874

http://americas.ccs.miami.edu/634-2/#comment-79398

https://generalsinjoburg.academic.wlu.edu/cultural-dance-festival-joubert-park-johannesburg-south-africa-march-2008/#comment-2468

http://syncd.commons.yale-nus.edu.sg/2015/06/16/hold-fast-dancing-for-the-victims-of-typhoon-haiyan/#comment-135712

https://www.ocf.berkeley.edu/~sather/avoiding-the-lobster-look-sunburns-sunscreen-and-spf-explained/#comment-359227

https://blogs.miamioh.edu/aaa201c/2016/11/different-cultures-understand-time-differently/#comment-201221

https://www.icsb.edu.bd/team-listing/#comment-388809

http://cmul.unilag.edu.ng/cmul-inducts-106-medical-and-dental-surgeons/#comment-214006

https://tabowles.wordpress.ncsu.edu/emerging-principles/#comment-42667

http://web.stanford.edu/dept/bosp/cgi-bin/blog/oaxaca17/index.php/2017/04/05/katies-intro-post/#comment-112291

https://generalsinjoburg.academic.wlu.edu/cultural-dance-festival-joubert-park-johannesburg-south-africa-march-2008/#comment-2470

http://syncd.commons.yale-nus.edu.sg/2015/06/16/hold-fast-dancing-for-the-victims-of-typhoon-haiyan/#comment-135717

http://americas.ccs.miami.edu/634-2/#comment-79400

https://www.ocf.berkeley.edu/~sather/avoiding-the-lobster-look-sunburns-sunscreen-and-spf-explained/#comment-359255

https://blogs.miamioh.edu/aaa201c/2016/11/different-cultures-understand-time-differently/#comment-201223

https://www.icsb.edu.bd/team-listing/#comment-388813

https://blogs.miamioh.edu/aaa201c/2016/11/different-cultures-understand-time-differently/#comment-201219

http://web.stanford.edu/dept/bosp/cgi-bin/blog/oaxaca17/index.php/2017/04/05/katies-intro-post/#comment-112299

https://tabowles.wordpress.ncsu.edu/emerging-principles/#comment-42670

http://cmul.unilag.edu.ng/cmul-inducts-106-medical-and-dental-surgeons/#comment-214011


Comments


  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

    Management,
    Medication Kings

    Website ... http://www.medicationkings.net

    Emails .... info@medicationkings.net

    +1 (503) 985-6723

    ReplyDelete

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