Get variable address in PHP

Description

The following code shows how to get variable address.

Example


/* w w  w .j  a  va 2s  .c  o m*/
<?php
  $a = 5;

  //$b points to the same place in memory as $a
  $b = &$a;

  //we're changing $b, since $a is pointing to
  //the same place - it changes too
  $b = 7;

  //prints 7
  print $a;
?>

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