note 69112 added to language.references.pass
| From: | randallgirard at hotmail dot com | Date: | Wed, 23 Aug 2006 16:32:22 +0000 |
| Subject: | note 69112 added to language.references.pass | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116230@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 216.194.113.175
Probable Submitter: 70.36.165.124
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.references.pass.php
Edit -- https://master.php.net/note/edit/69112
Del: integrated -- https://master.php.net/note/delete/69112/integrated
Del: useless -- https://master.php.net/note/delete/69112/useless
Del: bad code -- https://master.php.net/note/delete/69112/bad+code
Del: spam -- https://master.php.net/note/delete/69112/spam
Del: non-english -- https://master.php.net/note/delete/69112/non-english
Del: in docs -- https://master.php.net/note/delete/69112/in+docs
Del: other reasons-- https://master.php.net/note/delete/69112
Reject -- https://master.php.net/note/reject/69112
Search -- https://master.php.net/manage/user-notes.php