note 43094 deleted from language.references.pass by googleguy
| From: | googleguy@php.net | Date: | Sun, 23 Feb 2014 17:22:38 +0000 |
| Subject: | note 43094 deleted from language.references.pass by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-198610@lists.php.net to get a copy of this message | ||
Note Submitter: php at meKILLTHIStatoandthisols dot org
----
Ever been in a situation where you have to write:
<?php
$t = 1 ;
$x =& $t ;
?>
or
<?php
$t = 1 ;
f( $t ) ;
?>
because you cannot pass constants by value. The function
<?php
function& pclone( $v ) {
return( $v ) ;
}
?>
lets you get ridd of the temporary variable. You can write:
<?php
$x =& pclone( 1 ) ;
?>
or
<?php
f( pclone( 1 ) ) ;
?>
Alternatively you can use the other alternative ;-)