Practice exercise -- Allocating memory                 


Loading data into memory:
1.  Instruct computer to allocate memory
2.  Invoke program statements to put data into allocated memory


Constant:
    A memory location whose value may not be changed

    General form:
       define ('CONSTANT_NAME', constantValue); 

    Examples:
       define ('NAME_PROMPT', "Enter your name");
       define ('PI', 3.1416);
       define ('FULL_CAPACITY', 30);

Variable:
    Memory location that may be changed

    $charIdentifier='a', $intIdentifier=1, ..., $stringIdentifier="hello";

Storing data:
    Store with an assignment statement

    $identifier = expression;

Printing (stored) data:

    print ($identifier1.$identifer2...);



Statement                            identifier    value after each statement
--------------------------------     -----------   ----------------------------
1.  $a;
    $b = 2;
    $a = $b;


2.  $d = 2; 
    $x = 3; 
    $y = 4;
    $y + 5 = $x * 3;


3.  $inches = 12.0;
    $inches *= 3.0;
    $feet = $inches / 12;


4.  define('E', 5);


5.  $x = -5.5;
    $y = 17.5;
    $d = 4;
    $y = $d - $x + $y;


6.  $n;
    $n = 1.23;


7.  $count = 0;
    print ($count++);
    print (++$count);