note 58222 added to language.references.arent

From: Date: Fri, 28 Oct 2005 03:10:55 +0000
Subject: note 58222 added to language.references.arent
Groups: php.notes 
Request: Send a blank email to php-notes+get-97717@lists.php.net to get a copy of this message
I can see why there is a big debate on this. I'm hoping this will clarify it a little. In PHP, as far as I can understand, when you assign a variable in the first place, that variable is a refrence to the value that the variable contains. <?php $var = "String"; // Creates the string "String" somewhere in memory. echo $var; /* When the echo function is called, it pulls the value of $var out of memory from wherever PHP decided to put it. PHP then ships this value off to your standard output. */ ?> Anyway, when you create a reference to the variable $var, it doesn't reference the variable's name, but rather its contents. For example: <?php $var2 = & $var; echo $var2; /* Calling this echo does ecactly the same thing as the echo in the code snippet above this one. Whether you echo $var or $var2, the same string in memory is sent to your standard output. */ ?> In the same sense of an array, $var and $var2 are like keys to the same value. The value being the string in memory. When you call a function that uses a reference, the reference is not less than the variable given as the argument, or anything more than it. It is that same variable except with a different name. ---- Manual Page -- http://www.php.net/manual/en/language.references.arent.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58222 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58222&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58222&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58222&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58222&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58222&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58222&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58222&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58222&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97717) next »