note 69112 deleted from language.references.pass by danbrown
| From: | danbrown@php.net | Date: | Thu, 28 Jan 2010 13:19:24 +0000 |
| Subject: | note 69112 deleted from language.references.pass by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165418@lists.php.net to get a copy of this message | ||
Note Submitter: randallgirard at hotmail dot com
----
Side note to post by: fdelizy at unfreeze dot net
function &CopyObject(&$object, &$target = null) {
$obj =& $this->_getObjIs($object);
if ( is_object($obj) ) {
if ( ! $parent =& $this->_getObjIs($target) ) {
$parent =& $obj->that;
}
if ( $parent && $objs =& $parent->objs ) {
$copied = $obj;
$objs[ $parent->index++ ] =& $copied;
return $copied;
}
}
}
(directly copied from my code)
Does not work. I then also tried:
function &CopyObject(&$object, &$target = $default=null) {
And again, same problem.
PHP Error: "Parse error: parse error, unexpected '=', expecting ')' in
/home/fragitup/public_html/template.php on line 457"
Hence, it does not even compile. Clearly, it doesn't like that = identifier there when it is
passing by reference.
I cannot find a way to pass a default value except for:
function &CopyObject(&$object, &$target) { ... }
And:
$obj->CopyObject($object, $null=null);
How irritating... I'm a Perl programmer myself, and PHP is just pissing me off with all of
it's limitations lol.