Doc #62406 [Opn->Csd]: Omitted passing by reference technique

From: Date: Mon, 25 Jun 2012 10:18:55 +0000
Subject: Doc #62406 [Opn->Csd]: Omitted passing by reference technique
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8503@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62406&edit=1 ID: 62406 Updated by: nikic@php.net Reported by: renwooller at gmail dot com Summary: Omitted passing by reference technique -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: This is called call time pass by reference and was deprecated in PHP 5.3 and subsequently removed in PHP 5.4. There is a small note about it in http://my.php.net/manual/en/language.references.pass.php. I don't think that any further mention is necessary as this feature no longer exists. Previous Comments: ------------------------------------------------------------------------ [2012-06-25 09:30:14] renwooller at gmail dot com Description: ------------ The page describing how to pass variables by reference (http://my.php.net/manual/en/language.references.whatdo.php) doesn't mention another technique of passing by reference which is to put the ampersand on the variable when the function is being called, rather than in the function definition. As a result, I'm not sure what the intended behaviour is eg: Could it cause a problem? Perhaps it's some side-effect of being able to declare arrays by reference that wasn't intended? Perhaps it is a handy tool? The documentation should mention it and clarify. Test script: --------------- <?php $a = 0; testRef($a); echo "no ref : $a \n"; $a = 0; testRef(&$a); echo "input ref : $a \n"; $a = 0; testRef($a); echo "function definition ref : $a \n"; $a = 0; testRef(&$a); echo "function definition and input ref : $a \n"; function testRef($a) { $a +=1; } function testRef2(&$a) { $a +=1; } ?> Expected result: ---------------- I don't know, that's the problem with the documentation. Maybe 'input ref' should actually be 0? Actual result: -------------- no ref : 0 input ref : 1 function definition ref : 0 function definition and input ref : 1 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62406&edit=1

« previous php.doc.bugs (#8503) next »