From:             [EMAIL PROTECTED]
Operating system: n/a
PHP version:      4.2.0
PHP Bug Type:     Documentation problem
Bug description:  confusing explanation of assigning by reference

<?php
$foo = 'Bob';              // Assign the value 'Bob' to $foo
$bar = &$foo;              // Reference $foo via $bar.
$bar = "My name is $bar";  // Alter $bar...
echo $foo;                 // $foo is altered too.
echo $bar;
?>

Why do '$bar = "My name is $bar";'? And then do 'echo $foo' *before* you
'echo $bar'? The point you're trying to make is surely expressed  better
like this:

<?php
$foo = 'Bob';              // Assign the value 'Bob' to $foo
$bar = &$foo;              // Reference $foo via $bar.
$bar = "Dave";  // Alter $bar...
echo $bar;                
echo $foo; // $foo is altered too.
?>


Clearer for the newcomer to programming, ne?
-- 
Edit bug report at http://bugs.php.net/?id=16738&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=16738&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=16738&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=16738&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=16738&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16738&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=16738&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=16738&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=16738&r=submittedtwice

Reply via email to