note 20939 added to language.variables

From: Date: Mon, 22 Apr 2002 20:06:02 +0000
Subject: note 20939 added to language.variables
Groups: php.notes 
Request: Send a blank email to php-notes+get-29698@lists.php.net to get a copy of this message
Dude, The below is a bad, needlessly confusing example for a reference aimed at beginners. <?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. ?> Sure, the previous example is equivalent, but why not make the point as simply as possible? Your documentation should target the 13-year-old shepherd boy in Iraq who's learnt English from MRE wrappers as well as the 29-year-old MIT geek. -- http://www.php.net/manual/en/language.variables.php http://master.php.net/manage/user-notes.php?action=edit+20939 http://master.php.net/manage/user-notes.php?action=delete+20939 http://master.php.net/manage/user-notes.php?action=reject+20939

« previous php.notes (#29698) next »