Assign variables with variable in PHP

Description

The following code shows how to assign variables with variable.

Example


<?php//  w  ww  . j av a  2 s  . c  om
  //create variable
  $a = "Apple";

  //assign $a to $b
  $b = $a;

  //change $a
  $a = "Ball";

  //prints Apple
  print($b);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Language Basic »




PHP Introduction
PHP Operators
PHP Statements
Variable
PHP Function Create
Exception
PHP Class Definition