note 30582 added to ref.com
| From: | php at racinghippo dot co dot uk | Date: | Sat, 22 Mar 2003 23:47:30 +0000 |
| Subject: | note 30582 added to ref.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45659@lists.php.net to get a copy of this message | ||
PASSING/RETURNING PARAMETERS BY REFERENCE
=========================================
Some COM functions not only return values through the return value, but also act upon a variable
passed to it as a parameter *By Reference*:
RetVal = DoSomethingTo (myVariable)
Simply sticking an '&' in front of myVariable doesn't work - you need to pass it
a variant of the correct type, as follows:
$myStringVariant = new VARIANT("over-write me", VT_BSTR);
$result = $comobj->DoSomethingTo( &$myStringVariant );
The value in the variant can then be retrieved by:
$theActualValue = $myStringVariant->value;
Other types of variant can be created as your needs demand - see the preceding section on the
VARIANT type.
--
http://www.php.net/manual/en/ref.com.php
http://master.php.net/manage/user-notes.php?action=edit+30582
http://master.php.net/manage/user-notes.php?action=delete+30582
http://master.php.net/manage/user-notes.php?action=reject+30582